vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I just followed the example from syslogd/priv_sep.c. It calls getpwnam(), endpwent() and keep using pw... Is syslogd wrong? Or am I missing something? ... pw = getpwnam("_syslogd"); if (pw == NULL) errx(1, "unknown user _syslogd"); endpwent(); child_pid = fork(); if (child_pid < 0) err(1, "fork() failed"); if (!child_pid) { if (chroot(pw->pw_dir) != 0) err(1, "unable to chroot"); if (chdir("/") != 0) err(1, "unable to chdir"); .... Daniel --- Henning Brauer <henning@openbsd.org> escreveu: > * Daniel Cid <danielcid@yahoo.com.br> [2005-05-23 > 07:13]: > > I was taking a look at some examples of privilege > > dropping and I found that portmap is not calling > > endpwent() after the call to getpwnam(). > > A small diff to add it is bellow. > > > > *this is the first time I send a diff to openbsd, > so > > please, be nice if I did something wrong... > > > > Thanks, > > > > Daniel > > > > $ cvs diff -u portmap.c > > Index: portmap.c > > > ================================================== ================= > > RCS file: /cvs/src/usr.sbin/portmap/portmap.c,v > > retrieving revision 1.33 > > diff -u -r1.33 portmap.c > > --- portmap.c 3 May 2005 01:01:15 -0000 > 1.33 > > +++ portmap.c 23 May 2005 04:01:32 -0000 > > @@ -246,6 +246,9 @@ > > syslog(LOG_ERR, "cannot chdir to > > /var/empty."); > > exit(1); > > } > > + > > + endpwent(); > > + > > chdir("/"); > > if (pw) { > > if (setgroups(1, &pw->pw_gid) == > -1 || > > no, you cannot call endpwent and still use the > getpwent return value - > see my commit from a few hours ago for the right fix > __________________________________________________ Converse com seus amigos em tempo real com o Yahoo! Messenger http://br.download.yahoo.com/messenger/ |