From: David Bailey Date: Sun, 21 Apr 2002 22:11:11 +0000 (+0000) Subject: This adds /useexisting to use current AFS creds, bypassing the initial X-Git-Tag: openafs-stable-1_2_4~31 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=567a37bbc8407fa13ada3148b85b68bd01f46ead;p=packages%2Fo%2Fopenafs.git This adds /useexisting to use current AFS creds, bypassing the initial 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) --- diff --git a/src/WINNT/afssvrmgr/cmdline.cpp b/src/WINNT/afssvrmgr/cmdline.cpp index 28bc8cb7a..229302768 100644 --- a/src/WINNT/afssvrmgr/cmdline.cpp +++ b/src/WINNT/afssvrmgr/cmdline.cpp @@ -12,6 +12,8 @@ extern "C" { #include } +#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);