chg_usr_exec.c (d583b39b) | chg_usr_exec.c (d33341fb) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 17 unchanged lines hidden (view full) --- 26 27#include <stdio.h> 28#include <stdlib.h> 29#include <unistd.h> 30#include <string.h> 31#include <errno.h> 32#include <pwd.h> 33 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 17 unchanged lines hidden (view full) --- 26 27#include <stdio.h> 28#include <stdlib.h> 29#include <unistd.h> 30#include <string.h> 31#include <errno.h> 32#include <pwd.h> 33 |
34/* extern int errno = 0; */ | 34#define EXECSHELL "/usr/xpg4/bin/sh" |
35 36int 37main(int argc, char *argv[]) 38{ 39 char *plogin = NULL; 40 char cmds[BUFSIZ] = { 0 }; 41 char sep[] = " "; 42 struct passwd *ppw = NULL; --- 20 unchanged lines hidden (view full) --- 63 perror("setgid"); 64 return (errno); 65 } 66 if (setuid(ppw->pw_uid) != 0) { 67 perror("setuid"); 68 return (errno); 69 } 70 | 35 36int 37main(int argc, char *argv[]) 38{ 39 char *plogin = NULL; 40 char cmds[BUFSIZ] = { 0 }; 41 char sep[] = " "; 42 struct passwd *ppw = NULL; --- 20 unchanged lines hidden (view full) --- 63 perror("setgid"); 64 return (errno); 65 } 66 if (setuid(ppw->pw_uid) != 0) { 67 perror("setuid"); 68 return (errno); 69 } 70 |
71 if (execl("/usr/xpg4/bin/sh", "sh", "-c", cmds, (char *)0) != 0) { 72 perror("execl"); | 71 if (execl(EXECSHELL, "sh", "-c", cmds, (char *)NULL) != 0) { 72 perror("execl: " EXECSHELL); |
73 return (errno); 74 } 75 76 return (0); 77} | 73 return (errno); 74 } 75 76 return (0); 77} |