Hi lists,

I had remodeled for vpopmail-1.2.9  because it was on business 
needs. The account of two or more postmasters can be made for 
one domain.

POSTMASTER ACCOUNTS are "postmaster" and starting by 
"postmaster-".

For example, if an account "postmaster-hoge" is made, this postmaster-hoge has 
same authority as "postmaster".

Thanks.

-----------------------------------------------------------
diff -r -u qmailadmin-1.2.9.org/auth.c qmailadmin-1.2.9/auth.c
--- qmailadmin-1.2.9.org/auth.c 2005-01-24 02:35:11.000000000 +0900
+++ qmailadmin-1.2.9/auth.c     2006-01-13 18:33:24.217852035 +0900
@@ -41,9 +41,11 @@
  struct vqpasswd *pw;
 {
  FILE *fs;
+ FILE *fs2;
  time_t time1; 
  time_t time2;
  char ip_value[MAX_BUFF];
+ char PLFile[MAX_BUFF];
  
   if( chdir(RealDir) < 0 ){
     snprintf (StatusMessage, sizeof(StatusMessage), "%s %s\n", html_text[171], 
RealDir);
@@ -52,6 +54,19 @@
     exit(0);
   }
 
+  if ( (strcmp(Username,"postmaster")==0) || 
+       (strncmp(Username,"postmaster-", 11)==0)) {
+    snprintf(PLFile, sizeof(PLFile), "%s/%s.qw", RealDir, Time);
+    fs2 = fopen(PLFile, "r");
+    if ( fs2 == NULL ) {
+      snprintf (StatusMessage, sizeof(StatusMessage), "%s\n", html_text[172]);
+      show_login();
+      vclose();
+      exit(0);
+    } 
+    fclose(fs2);
+  }
+
   snprintf(TmpBuf1, sizeof(TmpBuf1), "%s/" MAILDIR "/%s.qw", pw->pw_dir, Time);
 
   fs = fopen(TmpBuf1, "r");
@@ -95,9 +110,11 @@
  struct vqpasswd *pw;
 {
  FILE *fs;
+ FILE *fs2;
  time_t time1; 
  time_t time2;
  char ip_value[MAX_BUFF];
+ char PLFile[MAX_BUFF];
 
   if ( chdir(RealDir) < 0 ) {
     snprintf (StatusMessage, sizeof(StatusMessage), "%s %s\n", html_text[171], 
RealDir );
@@ -106,6 +123,19 @@
     exit(0);
   }
 
+  if ( (strcmp(Username,"postmaster")==0) || 
+       (strncmp(Username,"postmaster-", 11)==0)) {
+    snprintf(PLFile, sizeof(PLFile), "%s/%s.qw", RealDir, Time);
+    fs2 = fopen(PLFile, "r");
+    if ( fs2 == NULL ) {
+      snprintf (StatusMessage, sizeof(StatusMessage), "%s\n", html_text[172]);
+      show_login();
+      vclose();
+      exit(0);
+    } 
+    fclose(fs2);
+  }
+
   snprintf(TmpBuf1, sizeof(TmpBuf1), "%s/" MAILDIR "/%s.qw", pw->pw_dir, Time);
 
   fs = fopen(TmpBuf1, "r");
@@ -153,7 +183,8 @@
   vpw = vauth_getpw(Username, Domain);
   AdminType = NO_ADMIN;
   if ( strlen(Domain) > 0 ) {
-    if ( strcmp(Username,"postmaster")==0 ) {
+    if ( (strcmp(Username,"postmaster")==0) || 
+        (strncmp(Username,"postmaster-", 11)==0)) {
       AdminType = DOMAIN_ADMIN;
 #ifdef VQPASSWD_HAS_PW_FLAGS
     } else if ( vpw->pw_flags & QA_ADMIN ) {
@@ -166,3 +197,4 @@
     }
   }
 }
+
diff -r -u qmailadmin-1.2.9.org/qmailadmin.c qmailadmin-1.2.9/qmailadmin.c
--- qmailadmin-1.2.9.org/qmailadmin.c   2005-08-11 02:42:49.000000000 +0900
+++ qmailadmin-1.2.9/qmailadmin.c       2006-01-13 18:31:14.235969767 +0900
@@ -283,6 +283,14 @@
          /* show the main menu for domain admins, modify user page
             for regular users */
          if (AdminType == DOMAIN_ADMIN) {
+          char PLFile[MAX_BUFF];
+          snprintf (PLFile, sizeof(PLFile), "%s", RealDir);
+          del_id_files(PLFile);
+
+          snprintf (PLFile, sizeof(PLFile), "%s/%u.qw", RealDir, (unsigned 
int) Mytime);
+          fs = fopen(PLFile,"w");
+          fputs(PLFile,fs);
+          fclose(fs);
            show_menu(Username, Domain, Mytime);
          } else {
            strcpy (ActionUser, Username);


-- 
Osamu Katagiri

Reply via email to