Constantly running out of sessionid's.

Gerald (Jerry) Carter jerry at samba.org
Wed Sep 27 16:10:48 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bartlett wrote:
> On Wed, 2006-09-27 at 08:12 -0500, Gerald (Jerry) Carter wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Harald Hannelius wrote:
>>
>>> Oh yes, but I (and the helldesk in particular) just love to be able to use 
>>> last, finger, w, who and friends to find out who has been using what.
>>>
>>> We are now nearing the limit:
>>>
>>> # sessionids.sh 
>>> tdb> tdb> 3568 records totalling 5537536 bytes
>>>
>>> (waiting with my fingers in my ears) :)
>>>
>>> Is there a bug that doesn't free sessionid's, or do we just have too many 
>>> users/computers?
>> You should be able to set MAX_SESSION_ID to an arbitrary value.
>> We should reclaim unused session ids.  So set it to something like
>> 10000 or what ever you need.
> 
> But wouldn't that break what he uses them for, being utmp?

Why?  Is there a limit in utmp ?  Or does this have to do
with the pty allocation or something?

BOOL session_claim(user_struct *vuser)
{
  ....
  if (lp_utmp()) {
    for (i=1;i<MAX_SESSION_ID;i++) {
      slprintf(keystr, sizeof(keystr)-1, "ID/%d", i);
      key.dptr = keystr;
      key.dsize = strlen(keystr)+1;

      if (tdb_store(tdb, key, data, TDB_INSERT) == 0) break;
    }

    if (i == MAX_SESSION_ID) {
      DEBUG(1,("session_claim: out of session IDs (max is %d)\n",
        MAX_SESSION_ID));
      return False;
     }
     slprintf(sessionid.id_str, sizeof(sessionid.id_str)-1,
       SESSION_UTMP_TEMPLATE, i);
     tdb_store_flag = TDB_MODIFY;
   }

  ....
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFGqKIIR7qMdg1EfYRAoZoAKDWe1qRHPrVa2i79vNmcSAu9J9vwwCfdI2K
eP65NU+vdz7aEp3RaH6NulI=
=Cf1f
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list