--- src/sendfiled.c			Mon Jul 23 16:08:03 2001
+++ src/sendfiled.c.diff		Thu Nov 20 02:47:59 2003
@@ -74,7 +74,7 @@
  *   1997-01-30	Framstag	better SIZE parsing
  *   1997-02-03	Framstag	sprintf() -> snprintf()
  *   1997-02-09	Framstag	new msg2tty interface (msgh,msg)
- *   1997-02-10	Framstag	added setegid-call (security!)
+ *   1997-02-10	Framstag	added setgid-call (security!)
  *   1997-02-12	Framstag	better IRIX and HP-UX support
  *   1997-02-13	Framstag	better OSF/1 support
  *   1997-02-23	Framstag	modified str_* function names
@@ -262,8 +262,8 @@
 #endif
 
 #ifdef HPUX
-  #define seteuid(a) setuid(a)
-  #define setegid(a) setgid(a)
+  #define setuid(a) setuid(a)
+  #define setgid(a) setgid(a)
 #endif
 
 #ifndef _PATH_UTMP
@@ -297,8 +297,8 @@
 int restricted(const char *, const char *, char);
 
 /* missed in <unistd.h> in some systems */
-int seteuid(uid_t);
-int setegid(gid_t);
+int setuid(uid_t);
+int setgid(gid_t);
 
 /* sendfile spool daemon for outgoing files */
 int sfsd(int, int, int, int, float);
@@ -963,8 +963,8 @@
 	fclose(inf);
       }
       
-      seteuid(0);
-      setegid(0);
+      setuid(0);
+      setgid(0);
 
       /* user forward? */
       if (forwarding && *forward && *filename && !*rpipe) {
@@ -1345,8 +1345,8 @@
       fprintf(dbf,"chdir: %d\n",chdir(userspool));
       fprintf(dbf,"ruid: %d (%d)\n",ruid,geteuid());
       fprintf(dbf,"rgid: %d (%d)\n",rgid,getegid());
-      fprintf(dbf,"setegid: %d\n",setegid(rgid));
-      fprintf(dbf,"seteuid: %d\n",seteuid(ruid));
+      fprintf(dbf,"setgid: %d\n",setgid(rgid));
+      fprintf(dbf,"setuid: %d\n",setuid(ruid));
 */
       /* convert back to UTF-7 and write to log file */
       if (msglog && check_userspool(recipient,userconfighome)==0 && 
@@ -1362,8 +1362,8 @@
 	  close(lfd);
 	}
       }
-      seteuid(0);
-      setegid(0);
+      setuid(0);
+      setgid(0);
 
       timetick=time(0);
       if (bell) strcat(msg,"\007");
@@ -1376,8 +1376,8 @@
       else {
 	
 	/* log sender address */
-	if (rgid) setegid(rgid);
-	if (ruid) seteuid(ruid);
+	if (rgid) setgid(rgid);
+	if (ruid) setuid(ruid);
 	snprintf(MAXS(tmp),"%s/msg@%s",userconfig,localhost);
 	if ((outf=rfopen(tmp,"w"))) {
 	  strcpy(tmp,sender);
@@ -1385,8 +1385,8 @@
 	  fprintf(outf,"%s\n",tmp);
 	}
 	fclose(outf);
-	seteuid(0);
-	setegid(0);
+	setuid(0);
+	setgid(0);
 	
         reply(200);
       }
@@ -1711,8 +1711,8 @@
       reply(201);
 
       /* reset uid and gid to root */
-      seteuid(0);
-      setegid(0);
+      setuid(0);
+      setgid(0);
 
       /* add entry to global logfile if required */
       /* ### todo: this part needs locking! ### */
@@ -1919,8 +1919,8 @@
       else
 	reply(530);
       
-      seteuid(0);
-      setegid(0);
+      setuid(0);
+      setgid(0);
 	     
       continue;
     }
@@ -2003,8 +2003,8 @@
 	
       }
 
-      seteuid(0);
-      setegid(0);
+      setuid(0);
+      setgid(0);
 	     
       continue;
     }
@@ -2097,8 +2097,8 @@
 	fclose(inf);
 	reply(250);
 	
-	seteuid(0);
-	setegid(0);
+	setuid(0);
+	setgid(0);
 	
 	continue;
       }
@@ -2129,8 +2129,8 @@
 	
 	close(infd);
 	
-	seteuid(0);
-	setegid(0);
+	setuid(0);
+	setgid(0);
 	
 	continue;
       }
@@ -2524,8 +2524,8 @@
     if (utmpfd<0) utmpfd=open("/var/adm/utmp",O_RDONLY);
     if (utmpfd<0) utmpfd=open("/var/run/utmp",O_RDONLY);
     if (utmpfd<0) {
-      seteuid(0);
-      setegid(0);
+      setuid(0);
+      setgid(0);
       return(-1);
     }
 
@@ -2562,8 +2562,8 @@
   }
 
   /* reset uid to root */
-  seteuid(0);
-  setegid(0);
+  setuid(0);
+  setgid(0);
 
   if (success>0) return(0); else return(-1);
 }
@@ -2597,8 +2597,8 @@
   /* change user */
   /* note: setuid does not work if euid>0 ! STUPID! */
   chdir(pwe->pw_dir);
-  seteuid(0);
-  setegid(0);
+  setuid(0);
+  setgid(0);
   if (setgid(rgid)<0) exit(1);
   initgroups(pwe->pw_name,pwe->pw_gid);
   if (setuid(ruid)<0) exit(1);
@@ -3592,13 +3592,13 @@
     chown(userspool,pwe->pw_uid,pwe->pw_gid);
 
   /* change uid and get user name */
-  if (setegid(finfo.st_gid)<0) exit(1);
-  if (seteuid(finfo.st_uid)<0) exit(1);
+  if (setgid(finfo.st_gid)<0) exit(1);
+  if (setuid(finfo.st_uid)<0) exit(1);
 
   if (!(inf=rfopen(oshfn,"r")) || chdir(userspool)<0) {
     fclose(inf);
-    seteuid(0);
-    setegid(0);
+    setuid(0);
+    setgid(0);
     chdir(cwd);
     return(-1);
   }
@@ -3608,8 +3608,8 @@
   id=spoolid(MAXLEN);
   if (id<=0 || id>MAXLEN) {
     fclose(inf);
-    seteuid(0);
-    setegid(0);
+    setuid(0);
+    setgid(0);
     chdir(cwd);
     return(-1);
   }
@@ -3620,8 +3620,8 @@
 
   if (!(outf=rfopen(shfn,"w"))) {
     fclose(inf);
-    seteuid(0);
-    setegid(0);
+    setuid(0);
+    setgid(0);
     chdir(cwd);
     return(-1);
   }
@@ -3673,8 +3673,8 @@
   utime(shfn,&utb);
   utime(sdfn,&utb);
 
-  seteuid(0);
-  setegid(0);
+  setuid(0);
+  setgid(0);
   chdir(cwd);
   return(0);
 }
@@ -3805,8 +3805,8 @@
       mkdir(userconfig,S_IRUSR|S_IWUSR|S_IXUSR);
   }
   
-  seteuid(0);
-  setegid(0);
+  setuid(0);
+  setgid(0);
 
   return(0);
 }
@@ -3873,7 +3873,7 @@
  * 
  * RETURN: log file descriptor
  * 
- * Be sure to call this function with correct seteuid/setegid settings!
+ * Be sure to call this function with correct setuid/setgid settings!
  */
 int openlog(const char *log) {
   int 
@@ -3883,8 +3883,8 @@
   struct stat finfo;	/* information about a file */
 
   /* security check */
-  if (rgid!=getegid()) { if (setegid(rgid)<0) return(0); }
-  if (ruid!=geteuid()) { if (seteuid(ruid)<0) return(0); }
+  if (rgid!=getegid()) { if (setgid(rgid)<0) return(0); }
+  if (ruid!=geteuid()) { if (setuid(ruid)<0) return(0); }
   
   /* create logfile if not there */
   close(open(log,O_CREAT|O_EXCL,S_IRUSR|S_IWUSR));
@@ -4000,13 +4000,13 @@
  * RETURN: nothing, but terminates program on error
  */
 void setreugid() {
-  if (rgid && setegid(rgid)<0) {
-    printf("490 Internal error on setegid(%u): %s\r\n",
+  if (rgid && setgid(rgid)<0) {
+    printf("490 Internal error on setgid(%u): %s\r\n",
 	   (unsigned int)rgid,strerror(errno));
     exit(1);
   }
-  if (ruid && seteuid(ruid)<0) {
-    printf("490 Internal error on seteuid(%u): %s\r\n",
+  if (ruid && setuid(ruid)<0) {
+    printf("490 Internal error on setuid(%u): %s\r\n",
 	   (unsigned int)ruid,strerror(errno));
     exit(1);
   }
@@ -4042,8 +4042,8 @@
   /* change user */
   /* note: setuid does not work if euid>0 ! STUPID! */
   chdir(pwe->pw_dir);
-  seteuid(0);
-  setegid(0);
+  setuid(0);
+  setgid(0);
   if (setgid(pwe->pw_gid)<0) exit(1);
   initgroups(user,pwe->pw_gid);
   if (setuid(pwe->pw_uid)<0) exit(1);
