X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fuserplex.c;h=357d791225b6f00dfd50a7ba6fbebb1ed9866a20;hb=9e70ef793ddcf51edc0f6489eb6f70762380afc0;hp=b66490f1ac57fdd34e9bfd8b04e380cc6d8470cf;hpb=470938bdc9149ae9c7befd0cd983f46fcc056192;p=ashd.git diff --git a/src/userplex.c b/src/userplex.c index b66490f..357d791 100644 --- a/src/userplex.c +++ b/src/userplex.c @@ -53,6 +53,7 @@ static void login(struct passwd *pwd) { int fd; + setsid(); if(getuid() == 0) { if(initgroups(pwd->pw_name, pwd->pw_gid)) { flog(LOG_ERR, "could not init group list for %s: %s", pwd->pw_name, strerror(errno)); @@ -86,12 +87,12 @@ static void login(struct passwd *pwd) * getting Kerberos credentials, running PAM session modules, and * who knows what. I'll add them along as I find them useful. */ if(((fd = open(".ashd/output", O_WRONLY | O_APPEND)) >= 0) || - ((fd = open("/dev/null", 0)) >= 0)) { + ((fd = open("/dev/null", O_WRONLY)) >= 0)) { dup2(fd, 1); close(fd); } if(((fd = open(".ashd/error", O_WRONLY | O_APPEND)) >= 0) || - ((fd = open("/dev/null", 0)) >= 0)) { + ((fd = open("/dev/null", O_WRONLY)) >= 0)) { dup2(fd, 2); close(fd); }