static void get_auth_data(const char *srv, const char *shr, char *wg, int wglen, char *un, int unlen, char *pw, int pwlen)
{
static char hasasked = 0;
+ static fstring savedwg;
+ static fstring savedun;
+ static fstring savedpw;
char *wgtmp, *usertmp;
char tmp[128];
- if(hasasked) return;
+ if (hasasked) {
+ strncpy(wg, savedwg, wglen-1);
+ strncpy(un, savedun, unlen-1);
+ strncpy(pw, savedpw, pwlen-1);
+ return;
+ }
hasasked = 1;
if(!nonprompt && !username) {
if(workgroup)strncpy(wg, workgroup, wglen-1);
+ // save the values found for later
+ strncpy(savedwg, wg, sizeof(savedwg)-1);
+ strncpy(savedun, un, sizeof(savedun)-1);
+ strncpy(savedpw, pw, sizeof(savedpw)-1);
+
wgtmp = SMB_STRNDUP(wg, wglen);
usertmp = SMB_STRNDUP(un, unlen);
if(!quiet)printf("Using workgroup %s, %s%s\n", wgtmp, *usertmp?"user ":"guest user", usertmp);