be029966f1
code up so it compiles cleaner.
82 lines
1.6 KiB
Text
82 lines
1.6 KiB
Text
*** parser.c Sat Jun 26 17:04:41 1993
|
|
--- parser.c Tue Apr 23 17:26:30 2013
|
|
***************
|
|
*** 11,22 ****
|
|
* Last modified: Sat Aug 20 18:47:54 1988
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
! #if defined(SVR4)
|
|
! # include <string.h>
|
|
! #else
|
|
! # include <strings.h>
|
|
! #endif /* SVR4 */
|
|
#include <pwd.h>
|
|
#include <ctype.h>
|
|
#include <sys/types.h>
|
|
--- 11,19 ----
|
|
* Last modified: Sat Aug 20 18:47:54 1988
|
|
*/
|
|
|
|
+ #include <stdlib.h>
|
|
#include <stdio.h>
|
|
! #include <string.h>
|
|
#include <pwd.h>
|
|
#include <ctype.h>
|
|
#include <sys/types.h>
|
|
***************
|
|
*** 71,79 ****
|
|
|
|
/* end of config params */
|
|
|
|
- struct passwd *getpwnam();
|
|
- char *malloc();
|
|
-
|
|
extern char *progname;
|
|
extern int debug;
|
|
|
|
--- 68,73 ----
|
|
***************
|
|
*** 89,94 ****
|
|
--- 83,89 ----
|
|
char *user;
|
|
{
|
|
struct passwd *pwd;
|
|
+ uid_t nobody;
|
|
static char line[LINE_LEN];
|
|
static char config[PATHLEN];
|
|
|
|
***************
|
|
*** 107,119 ****
|
|
a->next = 0;
|
|
cur_ali = aliases = a;
|
|
|
|
if (!(pwd = getpwnam(user)))
|
|
return(ERR_UNK_USER);
|
|
|
|
if (root) {
|
|
(void) setgid (pwd->pw_gid);
|
|
if (setuid (pwd->pw_uid) == -1)
|
|
! (void) setuid(NOBODY);
|
|
}
|
|
|
|
(void) strcpy (home, pwd->pw_dir);
|
|
--- 102,119 ----
|
|
a->next = 0;
|
|
cur_ali = aliases = a;
|
|
|
|
+ if (!(pwd = getpwnam("nobody")))
|
|
+ exit(67);
|
|
+
|
|
+ nobody = pwd->pw_uid;
|
|
+
|
|
if (!(pwd = getpwnam(user)))
|
|
return(ERR_UNK_USER);
|
|
|
|
if (root) {
|
|
(void) setgid (pwd->pw_gid);
|
|
if (setuid (pwd->pw_uid) == -1)
|
|
! (void) setuid(nobody);
|
|
}
|
|
|
|
(void) strcpy (home, pwd->pw_dir);
|