comparison svr-agentfwd.c @ 33:f789045062e6

Progressing client support
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Jul 2004 16:30:46 +0000
parents db2c8e6fb284
children 20563735e8b5
comparison
equal deleted inserted replaced
32:8fd0cdbb5b1b 33:f789045062e6
150 150
151 /* Remove the dir as the user. That way they can't cause problems except 151 /* Remove the dir as the user. That way they can't cause problems except
152 * for themselves */ 152 * for themselves */
153 uid = getuid(); 153 uid = getuid();
154 gid = getgid(); 154 gid = getgid();
155 if ((setegid(svr_ses.authstate.pw->pw_gid)) < 0 || 155 if ((setegid(ses.authstate.pw->pw_gid)) < 0 ||
156 (seteuid(svr_ses.authstate.pw->pw_uid)) < 0) { 156 (seteuid(ses.authstate.pw->pw_uid)) < 0) {
157 dropbear_exit("failed to set euid"); 157 dropbear_exit("failed to set euid");
158 } 158 }
159 159
160 /* 2 for "/" and "\0" */ 160 /* 2 for "/" and "\0" */
161 len = strlen(chansess->agentdir) + strlen(chansess->agentfile) + 2; 161 len = strlen(chansess->agentdir) + strlen(chansess->agentfile) + 2;
213 int ret = DROPBEAR_FAILURE; 213 int ret = DROPBEAR_FAILURE;
214 214
215 /* drop to user privs to make the dir/file */ 215 /* drop to user privs to make the dir/file */
216 uid = getuid(); 216 uid = getuid();
217 gid = getgid(); 217 gid = getgid();
218 if ((setegid(svr_ses.authstate.pw->pw_gid)) < 0 || 218 if ((setegid(ses.authstate.pw->pw_gid)) < 0 ||
219 (seteuid(svr_ses.authstate.pw->pw_uid)) < 0) { 219 (seteuid(ses.authstate.pw->pw_uid)) < 0) {
220 dropbear_exit("failed to set euid"); 220 dropbear_exit("failed to set euid");
221 } 221 }
222 222
223 memset((void*)&addr, 0x0, sizeof(addr)); 223 memset((void*)&addr, 0x0, sizeof(addr));
224 addr.sun_family = AF_UNIX; 224 addr.sun_family = AF_UNIX;