From: David Bailey Date: Mon, 1 Apr 2002 17:25:37 +0000 (+0000) Subject: winnt-servermgr-use-existing-creds-option-20020401 X-Git-Tag: openafs-devel_1_3_3~165 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b0e4e7bcbfb911563f68cd91c21d905738123d72;p=packages%2Fo%2Fopenafs.git winnt-servermgr-use-existing-creds-option-20020401 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. --- 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);