Update of /cvsroot/vpopmail/vpopmail In directory sc8-pr-cvs1:/tmp/cvs-serv1963
Modified Files: vlimits.h vlimits.c vcdb.c vactivedir.c vldap.c vmysql.c vpgsql.c vsybase.c Log Message: fix and move pw_flags setting code to vlimits.c
Index: vlimits.h
===================================================================
RCS file: /cvsroot/vpopmail/vpopmail/vlimits.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- vlimits.h 21 Oct 2003 21:24:37 -0000 1.5
+++ vlimits.h 3 Dec 2003 16:41:14 -0000 1.6
@@ -57,4 +57,5 @@
int vlimits_read_limits_file(const char * dir, struct vlimits * limits);
int vlimits_write_limits_file(const char * dir, const struct vlimits * limits);
int vlimits_get_flag_mask(struct vlimits *limits);
+void vlimits_setflags (struct vqpasswd *pw, char *domain);
#endif
Index: vlimits.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vlimits.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- vlimits.c 23 Nov 2003 19:27:39 -0000 1.8 +++ vlimits.c 3 Dec 2003 16:41:14 -0000 1.9 @@ -365,4 +365,13 @@ return unlink(dir); }
+void vlimits_setflags (struct vqpasswd *pw, char *domain) +{ + struct vlimits limits; + + if ((! (pw->pw_gid & V_OVERRIDE)) + && (vget_limits (domain, &limits) == 0)) { + pw->pw_flags = pw->pw_gid | vlimits_get_flag_mask (&limits); + } else pw->pw_flags = pw->pw_gid; +} #endif
Index: vcdb.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vcdb.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- vcdb.c 15 Nov 2003 06:55:43 -0000 1.10 +++ vcdb.c 3 Dec 2003 16:41:14 -0000 1.11 @@ -231,7 +231,6 @@ #ifdef FILE_LOCKING FILE *lock_fs; #endif - struct vlimits limits;
verrori = 0; lowerit(user); @@ -311,10 +310,7 @@ if (!*uid) { pwent.pw_uid = 0; } else { pwent.pw_uid = atoi(uid); } if (!*gid) { pwent.pw_gid = 0; } else { pwent.pw_gid = atoi(gid); }
- if ((! pwent.pw_gid & V_OVERRIDE)
- && (vget_limits (in_domain, &limits) == 0)) {
- pwent.pw_flags = pwent.pw_gid | vlimits_get_flag_mask (&limits);
- } else pwent.pw_flags = pwent.pw_gid;
+ vlimits_setflags (&pwent, in_domain);
#ifdef DEBUG
fprintf (stderr,"vgetpw: db: results: pw_name = %s\n",pwent.pw_name);
Index: vactivedir.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vactivedir.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- vactivedir.c 15 Nov 2003 06:55:43 -0000 1.8 +++ vactivedir.c 3 Dec 2003 16:41:14 -0000 1.9 @@ -160,7 +160,6 @@ static struct vqpasswd vpw; static struct actdirvp adir; int sock; - struct vlimits limits;
if ( (sock=ad_open_conn())==-1){ printf("could not connect\n"); @@ -189,10 +188,7 @@
ad_fill_vpw(&vpw,&adir);
- if ((! vpw.pw_gid & V_OVERRIDE) - && (vget_limits (domain, &limits) == 0)) { - vpw.pw_flags = vpw.pw_gid | vlimits_get_flag_mask (&limits); - } else vpw.pw_flags = vpw.pw_gid; + vlimits_setflags (&vpw, domain);
return(&vpw); }
Index: vldap.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vldap.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- vldap.c 15 Nov 2003 06:55:44 -0000 1.10 +++ vldap.c 3 Dec 2003 16:41:14 -0000 1.11 @@ -70,7 +70,6 @@ uid_t myuid; uid_t uid; gid_t gid; - struct vlimits limits;
verrori = 0; lowerit(user); @@ -287,10 +286,7 @@ } #endif
- if ((! vpw->pw_gid & V_OVERRIDE) - && (vget_limits (domain, &limits) == 0)) { - vpw->pw_flags = vpw->pw_gid | vlimits_get_flag_mask (&limits); - } else vpw->pw_flags = vpw->pw_gid; + vlimits_setflags (vpw, domain);
return vpw;
Index: vmysql.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vmysql.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- vmysql.c 15 Nov 2003 06:55:44 -0000 1.10 +++ vmysql.c 3 Dec 2003 16:41:14 -0000 1.11 @@ -417,7 +417,6 @@ uid_t myuid; uid_t uid; gid_t gid; - struct vlimits limits;
vget_assign(domain,NULL,0,&uid,&gid);
@@ -496,10 +495,7 @@ } mysql_free_result(res_read);
- if ((! vpw.pw_gid & V_OVERRIDE) - && (vget_limits (in_domain, &limits) == 0)) { - vpw.pw_flags = vpw.pw_gid | vlimits_get_flag_mask (&limits); - } else vpw.pw_flags = vpw.pw_gid; + vlimits_setflags (&vpw, in_domain);
return(&vpw); }
Index: vpgsql.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vpgsql.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- vpgsql.c 15 Nov 2003 06:55:44 -0000 1.11 +++ vpgsql.c 3 Dec 2003 16:41:14 -0000 1.12 @@ -249,7 +249,6 @@ static struct vqpasswd vpw; int err; PGresult *pgres; - struct vlimits limits;
verrori = 0; if ( (err=vauth_open()) != 0 ) { @@ -317,10 +316,7 @@ strncpy(vpw.pw_clear_passwd, PQgetvalue( pgres, 0, 7 ),SMALL_BUFF); #endif
- if ((! vpw.pw_gid & V_OVERRIDE) - && (vget_limits (in_domain, &limits) == 0)) { - vpw.pw_flags = vpw.pw_gid | vlimits_get_flag_mask (&limits); - } else vpw.pw_flags = vpw.pw_gid; + vlimits_setflags (&vpw, in_domain);
return(&vpw); }
Index: vsybase.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vsybase.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- vsybase.c 2 Nov 2003 11:53:28 -0000 1.7 +++ vsybase.c 3 Dec 2003 16:41:14 -0000 1.8 @@ -232,7 +232,6 @@ char in_domain[156]; char *domstr; static struct vqpasswd pwent; - struct vlimits limits;
lowerit(user); lowerit(domain); @@ -280,10 +279,7 @@ dbcancel(dbproc); if ( mem_size == 0 ) return(NULL);
- if ((! pwent.pw_gid & V_OVERRIDE) - && (vget_limits (in_domain, &limits) == 0)) { - pwent.pw_flags = pwent.pw_gid | vlimits_get_flag_mask (&limits); - } else pwent.pw_flags = pwent.pw_gid; + vlimits_setflags (&pwent, in_domain);
return(&pwent); }