David Lee <t.d.lee@durham.ac.uk> provides some corrections to the comments
authorAndrew Bartlett <abartlet@samba.org>
Fri, 16 May 2003 12:15:04 +0000 (12:15 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 16 May 2003 12:15:04 +0000 (12:15 +0000)
in the UTMP code.

Andrew Bartlett

source/smbd/utmp.c

index 84ec364654940e7d2c471f85fd5e83c9718e8fbd..2c5a1abc8245036ef7b42dfdc86b5f3d085f9c82 100644 (file)
@@ -81,11 +81,11 @@ lastlog:
 
 Notes:
        Each connection requires a small number (starting at 0, working up)
-       to represent the line (unum).  This must be unique within and across
-       all smbd processes.
+       to represent the line.  This must be unique within and across all
+       smbd processes.  It is the 'id_num' from Samba's session.c code.
 
        The 4 byte 'ut_id' component is vital to distinguish connections,
-       of which there could be several hundered or even thousand.
+       of which there could be several hundred or even thousand.
        Entries seem to be printable characters, with optional NULL pads.
 
        We need to be distinct from other entries in utmp/wtmp.
@@ -105,11 +105,8 @@ Notes:
        Arbitrarily I have chosen to use a distinctive 'SM' for the
        first two bytes.
 
-       The remaining two encode the "unum" (see above).
-
-       For "utmp consolidate" the suggestion was made to encode the pid into
-       those remaining two bytes (16 bits).  But recent UNIX (e.g Solaris 8)
-       is migrating to pids > 16 bits, so we ought not to do this.
+       The remaining two bytes encode the session 'id_num' (see above).
+       Our caller (session.c) should note our 16-bit limitation.
 
 ****************************************************************************/
 
@@ -125,33 +122,6 @@ Notes:
 #include <lastlog.h>
 #endif
 
-/****************************************************************************
- Obtain/release a small number (0 upwards) unique within and across smbds.
-****************************************************************************/
-/*
- * Need a "small" number to represent this connection, unique within this
- * smbd and across all smbds.
- *
- * claim:
- *     Start at 0, hunt up for free, unique number "unum" by attempting to
- *     store it as a key in a tdb database:
- *             key: unum               data: pid+conn  
- *     Also store its inverse, ready for yield function:
- *             key: pid+conn           data: unum
- *
- * yield:
- *     Find key: pid+conn; data is unum;  delete record
- *     Find key: unum ; delete record.
- *
- * Comment:
- *     The claim algorithm (a "for" loop attempting to store numbers in a tdb
- *     database) will be increasingly inefficient with larger numbers of
- *     connections.  Is it possible to write a suitable primitive within tdb?
- *
- *     However, by also storing the inverse key/data pair, we at least make
- *     the yield algorithm efficient.
- */
-
 /****************************************************************************
  Default paths to various {u,w}tmp{,x} files.
 ****************************************************************************/
@@ -504,10 +474,6 @@ static BOOL sys_utmp_fill(struct utmp *u,
        /*
         * ut_line:
         *      If size limit proves troublesome, then perhaps use "ut_id_encode()".
-        *
-        * Temporary variable "line_tmp" avoids trouble:
-        * o  with unwanted trailing NULL if ut_line full;
-        * o  with overflow if ut_line would be more than full.
         */
        if (strlen(id_str) > sizeof(u->ut_line)) {
                DEBUG(1,("id_str [%s] is too long for %d char utmp field\n",