Samba utmp patch
David Lee
T.D.Lee at durham.ac.uk
Thu Apr 6 11:33:43 GMT 2000
On Thu, 6 Apr 2000, Giulio Orsero wrote:
> I grep for UT to be sure not to leave anything out:
>
> # grep UT config.h
> [...]
> #define HAVE_UT_UT_NAME 1
> #define HAVE_UT_UT_USER 1
Several OSs seem to #define one of these as the other, so they are
equivalent. I don't think it does any harm. (We end up writing the field
twice. The alternative of trying to detect it etc. would be far more
complicated, bug-prone and not worthwhile merely to save one rarely-called
runtime assignment function.)
> #define HAVE_UT_UT_TIME 1
> #define HAVE_UT_UT_TV 1
Both. Interesting. I see from the "utmp.h" (redaht 6.1?) you sent me a
few weeks ago that there is a:
#define ut_time ut_tv.tv_sec
coming into play here ("struct utmp" contains "struct timeval ut_tv").
Like UT_NAME and UT_USER above, but slightly more subtle.
> # make
> ..
> Using LIBS = -lreadline -ldl -lcrypt -lpam
> Compiling smbd/server.c
> Compiling smbd/files.c
> Compiling smbd/chgpasswd.c
> Compiling smbd/connection.c
> smbd/connection.c: In function `utmp_fill':
> smbd/connection.c:364: incompatible types in assignment
> smbd/connection.c:369: `ut' undeclared (first use in this function)
> smbd/connection.c:369: (Each undeclared identifier is reported only once
> smbd/connection.c:369: for each function it appears in.)
> make: *** [smbd/connection.o] Error 1
>
> connection.c
> 362 #if defined(HAVE_UT_UT_TV)
> 363 gettimeofday(&timeval, NULL);
> 364 u->ut_time = timeval;
> 365 #endif /* defined(HAVE_UT_UT_TV) */
> 366
> 367 #if defined(HAVE_UT_UT_HOST)
> 368 if (host) {
> 369 pstrcpy(ut.ut_host, host);
> 370 }
> 371 #endif /* defined(HAVE_UT_UT_HOST) */
> 372
> 373 #if defined(HAVE_UT_UT_ID)
> 374 rc = ut_id_encode(i, u->ut_id);
> 375 #endif /* defined(HAVE_UT_UT_ID) */
> 376
> 377 return(rc);
Line 369: Just a straightforward typo in the patch: change "ut.ut_host"
to "u.ut_host".
Line 364: Hopefully only a typo (I hope it's not more complicated!)
Try changing "u->ut_time" to "u->ut_tv".
Can you try those and report back a.s.a.p. ?
I'm preparing a revised version ".2" of the patch on the assumption that
the above corrections are OK.
Many thanks again for your work on this.
--
: David Lee I.T. Service :
: Systems Programmer Computer Centre :
: University of Durham :
: http://www.dur.ac.uk/~dcl0tdl South Road :
: Durham :
: Phone: +44 191 374 2882 U.K. :
More information about the samba-technical
mailing list