Branch: Tag:

2017-09-28

2017-09-28 13:32:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

create_configif: Don't create a user in --batch mode if no password.

Fixes some more of [WS-69].

126:    user The name of the administrator.    Defaults to \"administrator\".    password The administrator password. -  NB: No default; if not specified, it -  will be queried interactively. +  NB: No default; if not specified, no +  administration user will be created.    ok Require interactive user confirmation of the    above information with the value pair \"ok n\".   
262:    }    }    +  // NB: Don't create a user if batch mode and no password. +  if (!batch || batch->password) {    do    { -  user = -  read_string(rl, "Administrator user name:", "user", "administrator"); +  user = read_string(rl, "Administrator user name:", "user", user);    if (batch) m_delete(batch, "user");    } while(((search(user, "/") != -1) || (search(user, "\\") != -1)) &&    write("User name may not contain slashes.\n"));
284:    else    write("\n");    } while(!strlen(password) || (password != passwd2)); +  }       if (!batch || has_prefix(lower_case(batch->ok || ""), "n")) {    passwd2 = read_string(rl, "Are the settings above correct [Y/n]?", 0, "");
360:    write("\n Administration interface created.\n");    }    +  if (password) {    string ufile=(configdir+"_configinterface/settings/" + user + "_uid");    mkdirhier( ufile );    Stdio.File( ufile, "wct", 0770 )
373:   </map>\n" ));       write("\n Administrator user \"" + user + "\" created.\n"); +  } else { +  write(#" +  +  NOTE: No administration user has been created. +  To create an administration user later; run +  +  create_configinterface -a\n");    } -  + }