[OpenAFS-devel] RE: [OpenAFS] Many questions

Michael Nelson mikenel@iapetus.com
Fri, 15 Dec 2000 11:13:50 -0500 (EST)


> Yes it seems that I loose the tokens after a while, after the first try of
> reaching anything in the afs filespace...

Yeah, that occurs when you don't use the integrated login feature
(afslog95/afslogon). I have a patch that works around that issue. I
haven't tested it very much, so caveat emptor.

--- ..\..\..\..\afs2\src\winnt\afsd\smb3.c      Fri Oct 13 10:32:43 2000
+++ smb3.c      Sun Nov 05 21:54:25 2000
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (C) 1998, 1989 Transarc Corporation - All rights reserved
  *
  * (C) COPYRIGHT IBM CORPORATION 1987, 1988
@@ -133,19 +133,22 @@
        usern = smb_ParseString(tp, &tp);

        /* Create a new UID and cm_user_t structure */
-       userp = cm_NewUser();
-       lock_ObtainMutex(&vcp->mx);
-       newUid = vcp->uidCounter++;
-       lock_ReleaseMutex(&vcp->mx);
+    if (vcp->uidCounter == 0)
+    {
+       userp = cm_NewUser();
+        lock_ObtainMutex(&vcp->mx);
+       newUid = vcp->uidCounter++;
+       lock_ReleaseMutex(&vcp->mx);
+
+       /* Create a new smb_user_t structure and connect them up */
+       uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
+       lock_ObtainMutex(&uidp->mx);
+       uidp->userp = userp;
+       uidp->name = strdup(usern);
+       lock_ReleaseMutex(&uidp->mx);
+       smb_ReleaseUID(uidp);
+    }

-       /* Create a new smb_user_t structure and connect them up */
-       uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
-       lock_ObtainMutex(&uidp->mx);
-       uidp->userp = userp;
-       uidp->name = strdup(usern);
-       lock_ReleaseMutex(&uidp->mx);
-       smb_ReleaseUID(uidp);
-
        if (dead_vcp) {
                dead_uidp = dead_vcp->usersp;
                while (dead_uidp) {
@@ -209,9 +212,9 @@
        }

        /* Return UID to the client */
-       ((smb_t *)outp)->uid = newUid;
        /* Also to the next chained message */
-       ((smb_t *)inp)->uid = newUid;
+       ((smb_t *)inp)->uid = 0; //newUid;

        osi_Log3(afsd_logp, "SMB3 session setup name %s creating ID %d%s",
                        osi_LogSaveString(afsd_logp, usern), newUid,
osi_LogSave
@@ -306,7 +309,7 @@
        lock_ObtainMutex(&vcp->mx);
         newTid = vcp->tidCounter++;
        lock_ReleaseMutex(&vcp->mx);
-
+
        tidp = smb_FindTID(vcp, newTid, SMB_FLAG_CREATE);
        shareFound = smb_FindShare(vcp, inp, shareName, &sharePath);
        if (!shareFound) {
@@ -329,7 +332,7 @@
         *tp++ = ':';
         *tp++ = 0;
         smb_SetSMBDataLength(outp, 3);
-
+
         osi_Log1(afsd_logp, "SMB3 tree connect created ID %d", newTid);
         return 0;
 }