On Tuesday, October 22, 2002, at 09:30  AM, Bill Shupp wrote:

I think that having qmailadmin always read from the master is the best solution. Unfortunately, it would require updating the vpopmail API to add an argument specifying whether to use a read server or not. Unless someone knows a way around it.

Short of that, one solution would be to merge the call to vpasswd into vauth_setpw, but as you pointed out above, the mkpasswd call from vpasswd, along with some other checking from that function, would need to added to modusergo. And to make sure that the next read doesn't get old information, you could go back to the main menu, or show_users instead of moduser. I could easily implement this solution this morning, if that's what people want to do.
Ok, for fun I went ahead and implemented this. The patch below is against vanilla 1.0.6, but it works for me. It consolidates the updates into one call by integrating much of vpasswd right into modusergo. There are still 3 select statements though, 2 before modusergo is called, and one during modusergo.

Also, at the end of the function, it calls show_users() instead of moduser(), which should help allow replication to catch up before the next read for that user.

Cheers,

Bill



*** user.c.orig Tue Oct 22 10:01:27 2002
--- user.c Tue Oct 22 10:28:05 2002
***************
*** 753,758 ****
--- 753,764 ----
static char NewBuf[156];
int count;
FILE *fs;
+ #ifdef SQWEBMAIL_PASS
+ uid_t uid;
+ gid_t gid;
+ #endif
+
+ vpw = vauth_getpw(ActionUser, Domain);

if (!( AdminType==DOMAIN_ADMIN ||
(AdminType==USER_ADMIN && strcmp(ActionUser,Username)==0))){
***************
*** 768,788 ****
vclose();
exit(0);
}
! ret_code = vpasswd( ActionUser, Domain, Password1, USE_POP);
! if ( ret_code != VA_SUCCESS ) {
sprintf(StatusMessage, "%s", get_html_text("140"));
} else {
! sprintf(StatusMessage,"%s %s@%s %s",
! get_html_text("139"), ActionUser, Domain, verror(ret_code) );
}
}

GetValue(TmpCGI,Gecos, "gecos=", MAX_BUFF);
if ( strlen( Gecos ) != 0 ) {
- vpw = vauth_getpw(ActionUser, Domain);
vpw->pw_gecos = Gecos;
- vauth_setpw(vpw, Domain);
}

/* get the value of the cforward radio button */
GetValue(TmpCGI,box, "cforward=", MAX_BUFF);
--- 774,813 ----
vclose();
exit(0);
}
! if (strlen(Password1) > MAX_PW_CLEAR_PASSWD) {
! sprintf(StatusMessage,"%s %s@%s %s",
! get_html_text("139"), ActionUser, Domain, VA_PASSWD_TOO_LONG );
! moduser();
! vclose();
! exit(0);
! } else if (vpw->pw_gid & NO_PASSWD_CHNG) {
sprintf(StatusMessage, "%s", get_html_text("140"));
+ moduser();
+ vclose();
+ exit(0);
} else {
! sprintf(StatusMessage,"%s %s@%s",
! get_html_text("139"), ActionUser, Domain);
}
+
+ mkpasswd3(Password1,Crypted, MAX_BUFF);
+ vpw->pw_passwd = Crypted;
+
+ #ifdef CLEAR_PASS
+ vpw->pw_clear_passwd = Password1;
+ #endif
+ #ifdef SQWEBMAIL_PASS
+ vget_assign(Domain, NULL, 0, &uid, &gid );
+ vsqwebmail_pass( vpw->pw_dir, Crypted, uid, gid);
+ #endif
+
}

GetValue(TmpCGI,Gecos, "gecos=", MAX_BUFF);
if ( strlen( Gecos ) != 0 ) {
vpw->pw_gecos = Gecos;
}
+ vauth_setpw(vpw, Domain);

/* get the value of the cforward radio button */
GetValue(TmpCGI,box, "cforward=", MAX_BUFF);
***************
*** 899,903 ****
}

call_hooks(HOOK_MODUSER);
! moduser();
}
--- 924,928 ----
}

call_hooks(HOOK_MODUSER);
! show_users(Username, Domain, Mytime);
}




Reply via email to