Commits (2)
  • Rob Swindell's avatar
    Don't truncate a user's record if the default download protocol or gender are '\0' · 6c0e423a
    Rob Swindell authored
    A blank download protocol field in a user.dat, when parsed, sets the 'prot' field
    of user_t to 0. When writing the record back to the user.dat, this would prematurely
    truncate all other fields off the user record (since strings in C are NUL terminated
    and we're using sprintf() to format the record and %c specifier for that field).
    
    The fix is to write a ' ' character instead of '\0' if the user_t.prot is '\0'.
    As part of this fix, I'm writing a '?' if a user_t.sex is '\0' (not sure if this
    is actually possible, but just as insurance). Those are the only 2 single-character
    user properties/fields today.
    
    Bug reported/debugged by Al of The Rusty Mailbox (1:153/757.2) - thank you!
    6c0e423a
  • Rob Swindell's avatar
    Don't run upgrade_to_v320 if user.dat doesn't exist · e9254a27
    Rob Swindell authored
    There's nothing to upgrade if there's no legacy userbase.
    e9254a27
......@@ -234,7 +234,7 @@ if(!upgraded)
js.exec("upgrade_to_v320.js", {});
print("Checking for v3.20 user base");
if(!file_exists(system.data_dir + 'user/user.tab')) {
if(file_exists(system.data_dir + 'user/user.dat') && !file_exists(system.data_dir + 'user/user.tab')) {
var cmdline = system.exec_dir + "upgrade_to_v320";
print("No v3.20 user base found, running " + cmdline);
system.exec(cmdline);
......
......@@ -687,7 +687,7 @@ BOOL format_userdat(scfg_t* cfg, user_t* user, char userdat[])
,user->zipcode
,user->phone
,user->birth
,user->sex
,user->sex ? user->sex : '?'
,user->comment
,user->modem
,user->misc
......@@ -698,7 +698,7 @@ BOOL format_userdat(scfg_t* cfg, user_t* user, char userdat[])
,user->xedit && user->xedit <= cfg->total_xedits ? cfg->xedit[user->xedit - 1]->code : ""
,user->shell < cfg->total_shells ? cfg->shell[user->shell]->code : ""
,user->tmpext
,user->prot
,user->prot ? user->prot : ' '
,user->cursub
,user->curdir
,user->curxtrn
......