]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
This adds /useexisting to use current AFS creds, bypassing the initial
authorDavid Bailey <D.Bailey@bristol.ac.uk>
Sun, 21 Apr 2002 22:11:11 +0000 (22:11 +0000)
committerGarry Zacheiss <zacheiss@mit.edu>
Sun, 21 Apr 2002 22:11:11 +0000 (22:11 +0000)
authentication dialog box. It's useful if you're not running kaserver
(i.e. if you've moved over to kerberos 5) and can't authenticate again
by the normal AFS means.

(cherry picked from commit b0e4e7bcbfb911563f68cd91c21d905738123d72)

src/WINNT/afssvrmgr/cmdline.cpp

index 28bc8cb7a06f9dd48dcec9dbf0547361cc2ba2da..2293027682bf041ac62f7520dcbfa15a8892a6c4 100644 (file)
@@ -12,6 +12,8 @@ extern "C" {
 #include <afs/stds.h>
 }
 
+#include "../afsapplib/afsapplib.h"
+
 #include "svrmgr.h"
 #include "cmdline.h"
 #include "action.h"
@@ -32,6 +34,7 @@ typedef enum {
    swUSER,
    swPASSWORD,
    swLOOKUP,
+   swUSEEXISTING
 } SWITCH;
 
 static struct {
@@ -40,14 +43,15 @@ static struct {
    BOOL fPresent;
    TCHAR szValue[ cchRESOURCE ];
 } aSWITCHES[] = {
-   { TEXT("cell"),      TRUE  },
-   { TEXT("subset"),    TRUE  },
-   { TEXT("server"),    TRUE  },
-   { TEXT("reset"),     FALSE },
-   { TEXT("confirm"),   FALSE },
-   { TEXT("user"),      TRUE  },
-   { TEXT("password"),  TRUE  },
-   { TEXT("lookup"),    FALSE }
+   { TEXT("cell"),        TRUE  },
+   { TEXT("subset"),      TRUE  },
+   { TEXT("server"),      TRUE  },
+   { TEXT("reset"),       FALSE },
+   { TEXT("confirm"),     FALSE },
+   { TEXT("user"),        TRUE  },
+   { TEXT("password"),    TRUE  },
+   { TEXT("lookup"),      FALSE },
+   { TEXT("useexisting"), FALSE }
 };
 
 #define nSWITCHES (sizeof(aSWITCHES) / sizeof(aSWITCHES[0]))
@@ -251,6 +255,36 @@ CMDLINEOP ParseCommandLine (LPTSTR pszCmdLine)
       return opLOOKUPERRORCODE;
       }
 
+   if (aSWITCHES[ swUSEEXISTING ].fPresent)
+     {
+       ULONG ulStatus;
+       TCHAR szDefCell[ cchNAME ];
+       
+       if (aSWITCHES[ swCELL ].fPresent)
+        {
+          lstrcpy(szDefCell,aSWITCHES[ swCELL ].szValue);
+        }
+       else
+        {
+          AfsAppLib_GetLocalCell(szDefCell);
+        }
+       g.hCreds = AfsAppLib_GetCredentials(szDefCell,&ulStatus);
+       if (g.hCreds != NULL)
+        {
+          LPOPENCELL_PACKET lpocp = New (OPENCELL_PACKET);
+
+          memset(lpocp,0x00,sizeof(OPENCELL_PACKET));
+          lstrcpy(lpocp->szCell,szDefCell);
+          lpocp->fCloseAppOnFail = TRUE;
+          lpocp->hCreds = g.hCreds;
+          lpocp->sub = NULL;
+          StartTask(taskOPENCELL,NULL,lpocp);
+          return opNOCELLDIALOG;
+        }
+       else
+        return opCLOSEAPP;
+     }
+
    if (aSWITCHES[ swCELL ].fPresent)
       {
       LPOPENCELL_PACKET lpp = New (OPENCELL_PACKET);