Comment 21 for bug 501956

Revision history for this message
In , Darren Tucker (dtucker) wrote :

Comment on attachment 787
BTMP PATCH Attached

I think we could commit the btmp logging part hooked up to CUSTOM_FAILED_LOGIN
(subject to some changes below) but I think the monitor parts should be
deferred until bug #125 is sorted.

>+#define _PATH_BTMP "/var/adm/btmp"

We'll put this in configure.ac. No big deal.

>+void
>+log_btmp(const char *username, const char *hostname)
>+{
[...]
>+ strcpy(ut.ut_line,"ssh:notty");

We don't use strcpy.

[lots of processing snipped]
>+ if (stat(_PATH_BTMP,&fst) == -1){
[...]
>+ fd = open(_PATH_BTMP, O_WRONLY | O_APPEND);

Not that this is a big deal but stat()ing the file then opening it is racy, and
building the record is a waste of time if you're not going to be able to write
it.

I think the sequence should be: open, fstat, construct record, write.

I'll do a patch with the above changes.