|
|
|
@ -32,8 +32,8 @@ |
|
|
|
|
2620301,1,000102030405060708090a0b0c0d0e0f,0f0e0d0c0b0a09080706050403020100,0001,32,0 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
static struct auc_rec *auc_rec_from_csv(void *ctx, |
|
|
|
|
const char *line_orig) |
|
|
|
|
static struct auc_rec * |
|
|
|
|
auc_rec_from_csv(void *ctx, const char *line_orig, long offset_nextline) |
|
|
|
|
{ |
|
|
|
|
char *line = talloc_strdup(ctx, line_orig); |
|
|
|
|
char *tok; |
|
|
|
@ -99,6 +99,13 @@ static struct auc_rec *auc_rec_from_csv(void *ctx, |
|
|
|
|
if (!tok) |
|
|
|
|
goto ret_free; |
|
|
|
|
rec->auth.u.umts.sqn = strtoull(tok, NULL, 10); |
|
|
|
|
if (strlen(tok) != 8) |
|
|
|
|
printf("SQN must be 8 digits wide in order to support updates\n"); |
|
|
|
|
else { |
|
|
|
|
/* save file offfset for SQN so we can update it */ |
|
|
|
|
rec->offset_sqn = offset_nextline - (strlen(line_orig) - (tok - line)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* IS_OP */ |
|
|
|
|
tok = strtok(NULL, ","); |
|
|
|
|
if (!tok) |
|
|
|
@ -191,11 +198,14 @@ int auc_storage_read(void *ctx, const char *fname) |
|
|
|
|
|
|
|
|
|
while ((line = fgets(line, 256, file))) { |
|
|
|
|
struct auc_rec *rec; |
|
|
|
|
long offset_nextline; |
|
|
|
|
|
|
|
|
|
if (line[0] == '#') |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
rec = auc_rec_from_csv(ctx, line); |
|
|
|
|
offset_nextline = ftell(file); |
|
|
|
|
|
|
|
|
|
rec = auc_rec_from_csv(ctx, line, offset_nextline); |
|
|
|
|
if (!rec) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|