Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 78256
Collapse All | Expand All

(-)main.c-orig (-2 / +23 lines)
Lines 6-11 Link Here
6
#include <stdio.h>
6
#include <stdio.h>
7
#include <unistd.h>
7
#include <unistd.h>
8
8
9
#include <sys/types.h>
10
#include <unistd.h>
11
12
9
#define LINE_MAX 256
13
#define LINE_MAX 256
10
#define SMTP_PASSWD_FILE "/etc/poppasswd"
14
#define SMTP_PASSWD_FILE "/etc/poppasswd"
11
char up[513];
15
char up[513];
Lines 22-31 Link Here
22
   unsigned char h;
26
   unsigned char h;
23
   FILE *fp;
27
   FILE *fp;
24
   int j;
28
   int j;
25
29
   uid_t uid;
30
   gid_t gid;
26
   char *linepnt;
31
   char *linepnt;
27
32
28
   if ((fp = fopen(SMTP_PASSWD_FILE, "rt")) == NULL) _exit(2);
33
   if ((fp = fopen(SMTP_PASSWD_FILE, "rt")) == NULL) _exit(2);
34
35
   uid = getuid();
36
   gid = getgid();
37
38
   if (gid != getegid()) {
39
   	if (setegid(gid))
40
		_exit(2);
41
   }
42
43
44
   if (uid && (uid != geteuid())) {
45
   	if (seteuid(uid))
46
		_exit(2);
47
   }
48
29
   while (fgets(line, LINE_MAX, fp) != NULL) {
49
   while (fgets(line, LINE_MAX, fp) != NULL) {
30
         if ((linepnt = strchr(line, '\n')) != NULL) {
50
         if ((linepnt = strchr(line, '\n')) != NULL) {
31
	 *linepnt = 0;
51
	 *linepnt = 0;
Lines 38-44 Link Here
38
	 break;
58
	 break;
39
      }
59
      }
40
   }   
60
   }   
41
   fclose(fp);
61
   
62
   if (EOF == fclose(fp)) _exit(2);
42
63
43
   if (!found_user) return(1);
64
   if (!found_user) return(1);
44
65

Return to bug 78256