flexlm borrowed licenses LM_BORROW_STAT struct

435 views Asked by At

I need to fix some legacy code that wraps flexlm 11. the code apparently worked with earlier flexlm versions, and something must have changed in the LM_BORROW_STAT in version 11.

The code retrieves the borrowed licenses with

lc_get_attr(_jobData->_job, LM_A_BORROW_STAT, (short*) &pBorrowStatus)

which are returned in a LM_BORROW_STAT struct as follows:

typedef struct _lm_borrow_stat {
struct _lm_borrow_stat *next;
char feature[MAX_FEATURE_LEN+1];
char vendor[MAX_VENDOR_NAME + 1];
time_t start;
time_t end;
char code[MAX_CRYPT_LEN + 1];
int borrow_binary_id;
} LM_BORROW_STAT;

The problem is the end date which always returns 0 -- the feature, vendor and start date work correctly, so something must have changed in struct or definition of LM_BORROW_STAT end. I know that the end date is stored in the borrowed license correctly, as flexlm accepts the license as valid.

As flexlm keeps expired borrowed licenses in the registry and returns them on enumeration, I need to access the end date to see which borrowed licenses are still valid and available.

Unfortunately I cannot find any developer/API reference for flexlm 11.

Does anyone know the correct way of reading the end date for flexlm 11 borrowed licenses, or alternatively just retrieving the valid/non-expired borrowed licenses?

1

There are 1 answers

0
aufziehvogel On

There indeed seems to have been a change in the FlexLM API since version 11.

Since I did not find documentation for version 11 either (Flexera Documentation area has totally different stuff?), I can only tell you that there seem to be two new values in the struct and end has been shifted.

typedef struct _lm_borrow_stat {
    struct _lm_borrow_stat *next;
    char feature[MAX_FEATURE_LEN+1];
    char vendor[MAX_VENDOR_NAME + 1];
    time_t start;
    long new_var_1;
    time_t end;
    long new_var_2;
    char code[MAX_CRYPT_LEN + 1];
    int borrow_binary_id;
} LM_BORROW_STAT;

The fact that this fixes the value of end in my eyes also means, that in the background they are reading this struct directly from memory.

So actually everything starting from end downwards is probably flawed with the old code when you use version 11.