Dag-Erling Smorgrav <[EMAIL PROTECTED]> writes: > Yep, the problem seems to be that sshd calls pam_open_session(3) too > early. I'm looking into it right now.
Try the attached patch. You'll need to rebuild libutil and restart sshd. DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED]
--- //depot/vendor/freebsd/src/lib/libutil/login.3 2001/10/01 09:45:21 +++ //depot/user/des/pam/lib/libutil/login.3 2002/04/18 11:56:04 @@ -46,7 +46,7 @@ .Ar ut entry being passed into the appropriate slot of the .Xr utmp 5 -file (according to the controlling terminal of the calling process), +file, and appends it to the .Xr wtmp 5 file. The calling process must have permission to write to both files. --- //depot/vendor/freebsd/src/lib/libutil/login.c 2002/03/22 00:19:01 +++ //depot/user/des/pam/lib/libutil/login.c 2002/04/18 11:56:04 @@ -44,19 +44,25 @@ #include <sys/types.h> #include <fcntl.h> +#include <libutil.h> +#include <stdlib.h> +#include <ttyent.h> #include <unistd.h> -#include <stdlib.h> #include <utmp.h> -#include <libutil.h> void login(ut) struct utmp *ut; { + struct ttyent *ty; int fd; int tty; - tty = ttyslot(); + setttyent(); + for (tty = 1; (ty = getttyent()) != NULL; ++tty) + if (strcmp(ty->ty_name, ut->ut_line) == 0) + break; + endttyent(); if (tty > 0 && (fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) { (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), L_SET); (void)write(fd, ut, sizeof(struct utmp));