afslogon-wix-cleanup-20040715
authorJeffrey Altman <jaltman@mit.edu>
Fri, 16 Jul 2004 04:38:25 +0000 (04:38 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 16 Jul 2004 04:38:25 +0000 (04:38 +0000)
- Fix NTMakefiles in many directories to define WIN32_LEAN_AND_MEAN NOGDI
  to avoid macro redefinitions

- update text files

- add "authentication cell" registry value for afscreds.exe

From asanka@mit.edu:

Network provider :

  -  If the user is logging into an AD domain, then look up the user's
     profile path, find out which cell it's in and then authenticate to
     that cell instead of the default cell.

  -  Domain specific registry keys

  -  A few fixes for handling UNICODE_STRINGs

smb3.c :

  -  Delete partial security context during negotiation

client_cpa :

  -  As per the SDK which says we must handle CPL_INQUIRE message, we do.
     Also fixes a small bug where the icon isn't properly set when viewing
     the Control Panel folder.

loopbackutils.cpp

  -  Don't bother setting the app data template, because we are setting
     it in the MSI anyway.

install/wix/NTMakefile

  -  Add a configurable symbol AFSDEV_AUXWIXDEFINES which can be used to
     customize a build of the msi.

install/wix

  -  Move afslogon.dll to SYSTEM32 directory

  -  Add registry keys to support WinLogon notifications.

  -  Rename afsdcell.ini to CellServDB and move it to the client directory.

  -  If there's already an afsdcell.ini in the Windows directory, copy
     that over to the client directory instead.

  -  Add descriptions to AFS client and server services

18 files changed:
doc/txt/winnotes/registry.txt
src/WINNT/afsd/afslogon.c
src/WINNT/afsd/afslogon.h [new file with mode: 0644]
src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsd/smb3.c
src/WINNT/client_cpa/afs_cpa_stub.rc
src/WINNT/client_cpa/cpl_interface.cpp
src/WINNT/client_creds/afswiz.cpp
src/WINNT/client_creds/creds.cpp
src/WINNT/client_exp/stdafx.h
src/WINNT/install/NSIS/CellServDB
src/WINNT/install/loopback/loopbackutils.cpp
src/WINNT/install/wix/CellServDB
src/WINNT/install/wix/feature.wxi
src/WINNT/install/wix/files.wxi
src/WINNT/install/wix/property.wxi
src/WINNT/install/wix/registry.wxi
src/util/errmap_nt.h

index 0a8a50f..412f875 100644 (file)
@@ -482,6 +482,18 @@ Function: Afscreds.exe GetDefaultCell()
 
 
 Regkey:
+[HKCU\SOFTWARE\OpenAFS\Client]
+
+Value   : Authentication Cell
+Type    : REG_SZ
+Default : <none>
+Function: Afscreds.exe GetDefaultCell()
+
+  This value allows the user to configure a different cell name to
+  be used as the default cell when acquiring tokens in afscreds.exe
+
+
+Regkey:
 [HKCU\SOFTWARE\OpenAFS\Client\Reminders]
 
 Value   : "afs cell name"
@@ -567,6 +579,77 @@ Default : <none>
     These values used to be stored in afsdsbmt.ini
 
 
+Regkey:
+[HKCU\SOFTWARE\OpenAFS\Client\Active Maps]
+
+Value   : "upper case drive letter"
+Type    : DWORD {0, 1}
+Default : <none>
+
+  These values are used to store the persistence state of the AFS 
+  drive mappings as listed in the [...\Client\Mappings] key
+
+  These values used to be stored in the afsdsbmt.ini file
+
+Regkey:
+[HKCU\SOFTWARE\OpenAFS\Client\Mappings]
+
+Value   : "upper case drive letter"
+Type    : REG_SZ
+Default : <none>
+
+  These values are used to store the AFS path in Unix notation
+  to which the drive letter is to be mapped.
+
+  These values used to be stored in the afsdsbmt.ini file.
+
+
+Regkey:
+[HKLM\SOFTWARE\OpenAFS\Client\CSCPolicy]
+
+Value   : "smb/cifs share name"
+Type    : REG_SZ
+Default : <none>
+
+    This key is used to map SMB/CIFS shares to Client Side Caching 
+    (off-line access) policies. For each share one of the following
+    policies may be used: "manual", "programs", "documents", "disable"
+
+    These values used to be stored in afsdsbmt.ini
+
+Regkey:
+[HKLM\SOFTWARE\OpenAFS\Client\Freelance]
+
+Value   : "numeric value"
+Type    : REG_SZ
+Default : <none>
+
+    This key is used to store newline terminated mount point strings 
+    for use in constructing the fake root.afs volume when Freelance
+    (dynamic roots) mode is activated.
+
+        "athena.mit.edu#athena.mit.edu:root.cell.\n"
+        ".athena.mit.edu%athena.mit.edu:root.cell.\n"
+
+    These values used to be stored in afs_freelance.ini
+
+
+Regkey:
+[HKLM\SOFTWARE\OpenAFS\Client\Submounts]
+
+Value   : "submount name"
+Type    : REG_SZ
+Default : <none>
+
+    This key is used to store mappings of unix style AFS paths
+    to submount names which can be referenced as UNC paths.
+    For example the submount string "/athena.mit.edu/user/j/a/jaltman"
+    can be associated with the submount name "jaltman.home".
+    This can then be referenced as the UNC path \\AFS\jaltman.home.
+
+    These values used to be stored in afsdsbmt.ini
+
+
 ENVIRONMENT VARIABLES:
 
 Variable: AFS_RPC_ENCRYPT 
index 2916b43..96bae52 100644 (file)
@@ -7,22 +7,24 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-#include <afs/param.h>
-#include <afs/stds.h>
+#include "afslogon.h"
+
+#include <io.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
 
-#include <windows.h>
-#include <npapi.h>
 #include <winsock2.h>
-#include "afsd.h"
+
+#include <afs/param.h>
+#include <afs/stds.h>
 #include <afs/pioctl_nt.h>
 #include <afs/kautils.h>
+
+#include "afsd.h"
 #include "cm_config.h"
 #include "krb.h"
-
-#include <io.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
+#include "afskfw.h"
 
 DWORD LogonOption,TraceOption;
 
@@ -30,47 +32,6 @@ HANDLE hDLL;
 
 WSADATA WSAjunk;
 
-#define REG_CLIENT_PARMS_KEY            "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"
-#define REG_CLIENT_PROVIDER_KEY                        "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider"
-#define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
-#define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
-#define DEFAULT_RETRY_INTERVAL          30                        /* seconds*/
-#define DEFAULT_FAIL_SILENTLY           FALSE
-#define DEFAULT_SLEEP_INTERVAL          5                         /* seconds*/
-
-#define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED)
-#define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY)
-
-#define TRACE_OPTION_EVENT 1
-#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
-
-#ifdef COMMENT
-/* Structure def copied from DDK (NTDEF.H) */
-typedef struct UNICODE_STRING {
-       USHORT Length;          /* number of bytes of Buffer actually used */
-       USHORT MaximumLength;   /* sizeof buffer in bytes */
-       WCHAR *Buffer;          /* 16 bit characters */
-} UNICODE_STRING;
-
-/* Structure def copied from NP API documentation */
-typedef struct _MSV1_0_INTERACTIVE_LOGON {
-       DWORD           MessageType;    /* Actually this is an enum; ignored */
-       UNICODE_STRING  LogonDomainName;
-       UNICODE_STRING  UserName;
-       UNICODE_STRING  Password;
-} MSV1_0_INTERACTIVE_LOGON;
-#endif
-
-/*
- * GetLogonScript
- *
- * We get a logon script pathname from the HKEY_LOCAL_MACHINE registry.
- * I don't know what good this does; I just copied it from DFS.
- *
- * Returns NULL on failure.
- */
-
-
 void DebugEvent0(char *a) 
 {
        HANDLE h; char *ptbuf[1];
@@ -87,9 +48,13 @@ void DebugEvent(char *a,char *b,...)
 {
        HANDLE h; char *ptbuf[1],buf[MAXBUF_+1];
        va_list marker;
+
        if (!ISLOGONTRACE(TraceOption))
                return;
-       h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
+
+       /*if(!a) */
+               a = AFS_DAEMON_EVENT_NAME;
+       h = RegisterEventSource(NULL, a);
        va_start(marker,b);
        _vsnprintf(buf,MAXBUF_,b,marker);
     buf[MAXBUF_] = '\0';
@@ -109,66 +74,6 @@ CHAR *GenRandomName(CHAR *pbuf)
        return pbuf;
 }
 
-WCHAR *GetLogonScript(CHAR *pname)
-{
-       WCHAR *script,*buf;
-       DWORD code;
-       DWORD LSPtype, LSPsize;
-       HKEY NPKey;
-       WCHAR randomName[MAXRANDOMNAMELEN];
-
-       /*
-        * Get Network Provider key.
-        * Assume this works or we wouldn't be here.
-        */
-       (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY,
-                           0, KEY_QUERY_VALUE, &NPKey);
-
-       /*
-        * Get Logon Script pathname length
-        */
-
-       code = RegQueryValueExW(NPKey, L"LogonScript", NULL,
-                               &LSPtype, NULL, &LSPsize);
-
-       if (code) {
-               RegCloseKey (NPKey);
-               return NULL;
-       }
-
-       if (LSPtype != REG_SZ) {        /* Maybe handle REG_EXPAND_SZ? */
-               RegCloseKey (NPKey);
-               return NULL;
-       }
-
-       buf=(WCHAR *)LocalAlloc(LMEM_FIXED,LSPsize);
-       script=(WCHAR *)LocalAlloc(LMEM_FIXED,LSPsize+(MAXRANDOMNAMELEN)*sizeof(WCHAR));
-       /*
-        * Explicitly call UNICODE version
-        * Assume it will succeed since it did before
-        */
-       (void) RegQueryValueExW(NPKey, L"LogonScript", NULL,
-                               &LSPtype, (LPBYTE)buf, &LSPsize);
-       MultiByteToWideChar(CP_ACP,0,pname,strlen(pname)+1,randomName,(strlen(pname)+1)*sizeof(WCHAR));
-       swprintf(script,buf,randomName);
-       LocalFree(buf);
-
-#ifdef DEBUG_VERBOSE
-    {
-        HANDLE h; char *ptbuf[1],buf[132],tbuf[255];
-               WideCharToMultiByte(CP_ACP,0,script,LSPsize,tbuf,255,NULL,NULL);
-        h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
-        sprintf(buf, "Script[%s,%d] Return Code[%x]",tbuf,LSPsize,code);
-        ptbuf[0] = buf;
-        ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
-        DeregisterEventSource(h);
-    }
-#endif
-
-       RegCloseKey (NPKey);
-       return script;
-}
-
 BOOLEAN AFSWillAutoStart(void)
 {
        SC_HANDLE scm;
@@ -180,7 +85,7 @@ BOOLEAN AFSWillAutoStart(void)
        LONG status;
 
        /* Open services manager */
-       scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+       scm = OpenSCManager(NULL, NULL, GENERIC_READ);
        if (!scm) return FALSE;
 
        /* Open AFSD service */
@@ -222,11 +127,15 @@ close_scm:
 DWORD MapAuthError(DWORD code)
 {
        switch (code) {
-       case KTC_NOCM:
+               /* Unfortunately, returning WN_NO_NETWORK results in the MPR abandoning
+                * logon scripts for all credential managers, although they will still
+                * receive logon notifications.  Since we don't want this, we return
+                * WN_SUCCESS.  This is highly undesirable, but we also don't want to
+                * break other network providers.
+                */
+/*     case KTC_NOCM:
        case KTC_NOCMRPC:
-               return WN_NO_NETWORK;
-/*     case INTK_BADPW: return WN_BAD_PASSWORD;*/
-/*     case KERB_ERR_PRINCIPAL_UNKNOWN: return WN_BAD_USER;*/
+               return WN_NO_NETWORK; */
        default: return WN_SUCCESS;
        }
 }
@@ -259,38 +168,16 @@ DWORD APIENTRY NPGetCaps(DWORD index)
                case WNNC_NET_TYPE:
                        /* Don't have our own type; use somebody else's. */
                        return WNNC_NET_SUN_PC_NFS;
+
+               case WNNC_START:
+                       /* Say we are already started, even though we might wait after we receive NPLogonNotify */
+                       return 1;
+
                default:
                        return 0;
        }
 }
 
-static void GetLoginBehavior(int *pRetryInterval, BOOLEAN *pFailSilently)
-{
-    long result;
-    HKEY hKey;
-    DWORD dummyLen;
-                
-       result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, 0, KEY_QUERY_VALUE, &hKey);
-    if (result != ERROR_SUCCESS) {
-        *pRetryInterval = DEFAULT_RETRY_INTERVAL;
-        *pFailSilently = DEFAULT_FAIL_SILENTLY;
-        return;
-    }
-        
-    result = RegQueryValueEx(hKey, REG_CLIENT_RETRY_INTERVAL_PARM, 0, 0, (BYTE *)pRetryInterval, &dummyLen);
-    if (result != ERROR_SUCCESS)
-        *pRetryInterval = DEFAULT_RETRY_INTERVAL;
-                       
-    result = RegQueryValueEx(hKey, REG_CLIENT_FAIL_SILENTLY_PARM, 0, 0, (BYTE *)pFailSilently, &dummyLen);
-    if (result != ERROR_SUCCESS)
-        *pFailSilently = DEFAULT_FAIL_SILENTLY;
-
-    /* Make sure this is really a bool value in the strict sense*/
-    *pFailSilently = !!*pFailSilently;
-
-    RegCloseKey(hKey);
-}   
-
 BOOL IsServiceRunning (void)
 {
     SERVICE_STATUS Status;
@@ -313,6 +200,279 @@ BOOL IsServiceRunning (void)
     return (Status.dwCurrentState == SERVICE_RUNNING);
 }   
 
+/* LOOKUPKEYCHAIN: macro to look up the value in the list of keys in order until it's found
+   v:variable to receive value (reference type)
+   t:type
+   d:default, in case the value isn't on any of the keys
+   n:name of value */
+#define LOOKUPKEYCHAIN(v,t,d,n) \
+       do { \
+               rv = ~ERROR_SUCCESS; \
+               dwType = t; \
+               if(hkDom) { \
+                       dwSize = sizeof(v); \
+                       rv = RegQueryValueEx(hkDom, n, 0, &dwType, (LPBYTE) &(v), &dwSize); \
+                       if(rv == ERROR_SUCCESS) DebugEvent(NULL, #v " found in hkDom with type [%d]", dwType); \
+               } \
+               if(hkDoms && (rv != ERROR_SUCCESS || dwType != t)) { \
+                       dwSize = sizeof(v); \
+                       rv = RegQueryValueEx(hkDoms, n, 0, &dwType, (LPBYTE) &(v), &dwSize); \
+                       if(rv == ERROR_SUCCESS) DebugEvent(NULL, #v " found in hkDoms with type [%d]", dwType); \
+               } \
+               if(hkNp && (rv != ERROR_SUCCESS || dwType != t)) { \
+                       dwSize = sizeof(v); \
+                       rv = RegQueryValueEx(hkNp, n, 0, &dwType, (LPBYTE) &(v), &dwSize); \
+                       if(rv == ERROR_SUCCESS) DebugEvent(NULL, #v " found in hkNp with type [%d]", dwType); \
+               } \
+               if(rv != ERROR_SUCCESS || dwType != t) { \
+                       v = d; \
+                       DebugEvent(NULL, #v " being set to default"); \
+               } \
+       } while(0)
+
+/* Get domain specific configuration info.  We are returning void because if anything goes wrong
+   we just return defaults.
+ */
+void GetDomainLogonOptions( PLUID lpLogonId, char * username, char * domain, LogonOptions_t *opt ) {
+       HKEY hkParm = NULL; /* Service parameter */
+       HKEY hkNp = NULL;   /* network provider key */
+       HKEY hkDoms = NULL; /* domains key */
+       HKEY hkDom = NULL;  /* DOMAINS/domain key */
+       HKEY hkTemp = NULL;
+       LONG rv;
+       DWORD dwSize;
+       DWORD dwType;
+       DWORD dwDummy;
+       char computerName[MAX_COMPUTERNAME_LENGTH + 1];
+       char *effDomain;
+
+       DebugEvent(NULL,"In GetDomainLogonOptions for user [%s] in domain [%s]", username, domain);
+       /* If the domain is the same as the Netbios computer name, we use the LOCALHOST domain name*/
+       opt->flags = LOGON_FLAG_REMOTE;
+       if(domain) {
+               dwSize = MAX_COMPUTERNAME_LENGTH;
+               if(GetComputerName(computerName, &dwSize)) {
+                       if(!stricmp(computerName, domain)) {
+                               effDomain = "LOCALHOST";
+                               opt->flags = LOGON_FLAG_LOCAL;
+                       }
+                       else
+                               effDomain = domain;
+               }
+       } else
+               effDomain = NULL;
+
+       rv = RegOpenKeyEx( HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, 0, KEY_READ, &hkParm );
+       if(rv != ERROR_SUCCESS) {
+               hkParm = NULL;
+               DebugEvent(NULL, "GetDomainLogonOption: Can't open parms key [%d]", rv);
+       }
+
+       rv = RegOpenKeyEx( HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY, 0, KEY_READ, &hkNp );
+       if(rv != ERROR_SUCCESS) {
+               hkNp = NULL;
+               DebugEvent(NULL, "GetDomainLogonOptions: Can't open NP key [%d]", rv);
+       }
+
+       if(hkNp) {
+               rv = RegOpenKeyEx( hkNp, REG_CLIENT_DOMAINS_SUBKEY, 0, KEY_READ, &hkDoms );
+               if( rv != ERROR_SUCCESS ) {
+                       hkDoms = NULL;
+                       DebugEvent(NULL, "GetDomainLogonOptions: Can't open Domains key [%d]", rv);
+               }
+       }
+
+       if(hkDoms && effDomain) {
+               rv = RegOpenKeyEx( hkDoms, effDomain, 0, KEY_READ, &hkDom );
+               if( rv != ERROR_SUCCESS ) {
+                       hkDom = NULL;
+                       DebugEvent( NULL, "GetDomainLogonOptions: Can't open domain key for [%s] [%d]", effDomain, rv);
+                       /* If none of the domains match, we shouldn't use the domain key either */
+                       RegCloseKey(hkDoms);
+                       hkDoms = NULL;
+               }
+       } else
+               DebugEvent( NULL, "Not opening domain key for [%s]", effDomain);
+
+       /* Each individual can either be specified on the domain key, the domains key or in the
+          net provider key.  They fail over in that order.  If none is found, we just use the 
+          defaults. */
+
+       /* LogonOption */
+       LOOKUPKEYCHAIN(opt->LogonOption, REG_DWORD, DEFAULT_LOGON_OPTION, REG_CLIENT_LOGON_OPTION_PARM);
+
+       /* FailLoginsSilently */
+       dwSize = sizeof(dwDummy);
+       rv = RegQueryValueEx(hkParm, REG_CLIENT_FAIL_SILENTLY_PARM, 0, &dwType, (LPBYTE) &dwDummy, &dwSize);
+       if(rv != ERROR_SUCCESS)
+               LOOKUPKEYCHAIN(dwDummy, REG_DWORD, DEFAULT_FAIL_SILENTLY, REG_CLIENT_FAIL_SILENTLY_PARM);
+    opt->failSilently = !!dwDummy;
+
+       /* Retry interval */
+       LOOKUPKEYCHAIN(opt->retryInterval, REG_DWORD, DEFAULT_RETRY_INTERVAL, REG_CLIENT_RETRY_INTERVAL_PARM);
+
+       /* Sleep interval */
+       LOOKUPKEYCHAIN(opt->sleepInterval, REG_DWORD, DEFAULT_SLEEP_INTERVAL, REG_CLIENT_SLEEP_INTERVAL_PARM);
+
+       opt->logonScript = NULL;
+       opt->smbName = NULL;
+
+       if(!ISLOGONINTEGRATED(opt->LogonOption)) {
+               goto cleanup; /* no need to lookup the logon script */
+       }
+
+       /* come up with SMB username */
+       if(ISHIGHSECURITY(opt->LogonOption)) {
+        opt->smbName = malloc( MAXRANDOMNAMELEN );
+               GenRandomName(opt->smbName);
+       } else {
+               /* username and domain for logon session is not necessarily the same as
+                  username and domain passed into network provider. */
+               PSECURITY_LOGON_SESSION_DATA plsd;
+               char lsaUsername[MAX_USERNAME_LENGTH];
+               char lsaDomain[MAX_DOMAIN_LENGTH];
+               int len;
+
+        LsaGetLogonSessionData(lpLogonId, &plsd);
+        
+               UnicodeStringToANSI(plsd->UserName, lsaUsername, MAX_USERNAME_LENGTH);
+               UnicodeStringToANSI(plsd->LogonDomain, lsaDomain, MAX_DOMAIN_LENGTH);
+
+               DebugEvent(NULL,"PLSD username[%s] domain[%s]",lsaUsername,lsaDomain);
+               DebugEvent(NULL,"PLSD Unicode username[%S] domain[%S]",plsd->UserName.Buffer,plsd->LogonDomain.Buffer);
+               DebugEvent(NULL,"PLSD lengths username[%d] domain[%d]",plsd->UserName.Length,plsd->LogonDomain.Length);
+
+        len = strlen(lsaUsername) + strlen(lsaDomain) + 2;
+
+               opt->smbName = malloc(len);
+
+               strcpy(opt->smbName, lsaDomain);
+               strcat(opt->smbName, "\\");
+               strcat(opt->smbName, lsaUsername);
+
+               strlwr(opt->smbName);
+
+               LsaFreeReturnBuffer(plsd);
+       }
+
+       DebugEvent(NULL,"Looking up logon script");
+       /* Logon script */
+       /* First find out where the key is */
+       hkTemp = NULL;
+       rv = ~ERROR_SUCCESS;
+       dwType = 0;
+       if(hkDom)
+           rv = RegQueryValueExW(hkDom, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, NULL, &dwSize);
+       if(rv == ERROR_SUCCESS && (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) {
+               hkTemp = hkDom;
+               DebugEvent(NULL,"Located logon script in hkDom");
+       }
+       else if(hkDoms)
+           rv = RegQueryValueExW(hkDoms, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, NULL, &dwSize);
+       if(rv == ERROR_SUCCESS && !hkTemp && (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) {
+               hkTemp = hkDoms;
+               DebugEvent(NULL,"Located logon script in hkDoms");
+       }
+       /* Note that the LogonScript in the NP key is only used if we are doing high security. */
+       else if(hkNp && ISHIGHSECURITY(opt->LogonOption))
+           rv = RegQueryValueExW(hkNp, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, NULL, &dwSize);
+       if(rv == ERROR_SUCCESS && !hkTemp && (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) {
+               hkTemp = hkNp;
+               DebugEvent(NULL,"Located logon script in hkNp");
+       }
+
+       if(hkTemp) {
+               WCHAR *regscript        = NULL;
+               WCHAR *regexscript      = NULL;
+               WCHAR *regexuscript     = NULL;
+               WCHAR *wuname           = NULL;
+               HRESULT hr;
+
+               int len = strlen(opt->smbName) + 1;
+
+               wuname = malloc(len * sizeof(WCHAR));
+               MultiByteToWideChar(CP_ACP,0,opt->smbName,-1,wuname,len*sizeof(WCHAR));
+
+               DebugEvent(NULL,"Username is set for [%S]", wuname);
+
+               /* dwSize still has the size of the required buffer in bytes. */
+        regscript = malloc(dwSize);
+               rv = RegQueryValueExW(hkTemp, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, (LPBYTE) regscript, &dwSize);
+               if(rv != ERROR_SUCCESS) {/* what the ..? */
+                       DebugEvent(NULL,"Can't look up logon script [%d]",rv);
+                       goto doneLogonScript;
+               }
+               
+               DebugEvent(NULL,"Found logon script [%S]", regscript);
+
+               if(dwType == REG_EXPAND_SZ) {
+                       dwSize += MAX_PATH * sizeof(WCHAR);  /* make room for environment expansion. */
+                       regexscript = malloc(dwSize);
+                       rv = ExpandEnvironmentStringsW(regscript, regexscript, dwSize / sizeof(WCHAR));
+                       free(regscript);
+                       regscript = regexscript;
+                       regexscript = NULL;
+                       if(rv > (dwSize / sizeof(WCHAR))) {
+                               DebugEvent(NULL,"Overflow while expanding environment strings.");
+                               goto doneLogonScript;
+                       }
+               }
+
+               DebugEvent(NULL,"After expanding env strings [%S]", regscript);
+
+               if(wcsstr(regscript, L"%s")) {
+               dwSize += 256 * sizeof(WCHAR); /* make room for username expansion */
+                       regexuscript = (WCHAR *) LocalAlloc(LMEM_FIXED, dwSize);
+                       hr = StringCbPrintfW(regexuscript, dwSize, regscript, wuname);
+               } else {
+                       regexuscript = (WCHAR *) LocalAlloc(LMEM_FIXED, dwSize);
+                       wcscpy(regexuscript, regscript);
+                       hr = S_OK;
+               }
+
+               DebugEvent(NULL,"After expanding username [%S]", regexuscript);
+
+               if(hr == S_OK)
+                       opt->logonScript = regexuscript;
+               else
+                       LocalFree(regexuscript);
+
+doneLogonScript:
+               if(wuname) free(wuname);
+               if(regscript) free(regscript);
+               if(regexscript) free(regexscript);
+       }
+
+cleanup:
+       if(hkNp) RegCloseKey(hkNp);
+       if(hkDom) RegCloseKey(hkDom);
+       if(hkDoms) RegCloseKey(hkDoms);
+       if(hkParm) RegCloseKey(hkParm);
+}
+
+#undef LOOKUPKEYCHAIN
+
+/* Try to find out which cell the given path is in.  We must retain
+   the contents of *cell in case of failure. *cell is assumed to be
+   at least cellLen chars */
+DWORD GetFileCellName(char * path, char * cell, size_t cellLen) {
+       struct ViceIoctl blob;
+       char tcell[MAX_PATH];
+       DWORD code;
+
+       blob.in_size = 0;
+       blob.out_size = MAX_PATH;
+       blob.out = tcell;
+
+       code = pioctl(path, VIOC_FILE_CELL_NAME, &blob, 1);
+
+       if(!code) {
+               strncpy(cell, tcell, cellLen);
+               cell[cellLen - 1] = '\0';
+       }
+       return code;
+}
+
 
 static BOOL
 WINAPI
@@ -326,15 +486,17 @@ UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOu
         // Only supporting non-Unicode strings
         return FALSE;
     
-    if (((LPBYTE) uInputString.Buffer)[1] == '\0')
+    if (uInputString.Buffer && ((LPBYTE) uInputString.Buffer)[1] == '\0')
     {
         // Looks like unicode, better translate it
         // UNICODE_STRING specifies the length of the buffer string in Bytes not WCHARS
         WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) uInputString.Buffer, uInputString.Length/2,
                             lpszOutputString, nOutStringLen-1, NULL, NULL);
-        lpszOutputString[max(uInputString.Length/2,nOutStringLen-1)] = '\0';
+        lpszOutputString[min(uInputString.Length/2,nOutStringLen-1)] = '\0';
         return TRUE;
     }
+       else
+               lpszOutputString[0] = '\0';
     return FALSE;
 }  // UnicodeStringToANSI
 
@@ -348,37 +510,53 @@ DWORD APIENTRY NPLogonNotify(
        LPVOID StationHandle,
        LPWSTR *lpLogonScript)
 {
-       char uname[256]="";
-       char *ctemp;
-       char password[256]="";
+       char uname[MAX_USERNAME_LENGTH]="";
+       char password[MAX_PASSWORD_LENGTH]="";
+       char logonDomain[MAX_DOMAIN_LENGTH]="";
        char cell[256]="<non-integrated logon>";
+       char homePath[MAX_PATH]="";
+
        MSV1_0_INTERACTIVE_LOGON *IL;
+
        DWORD code;
+       int len;
+
        int pw_exp;
        char *reason;
+       char *ctemp;
+
        BOOLEAN interactive;
        BOOLEAN flag;
        DWORD LSPtype, LSPsize;
        HKEY NPKey;
+
        HWND hwndOwner = (HWND)StationHandle;
-    BOOLEAN failSilently;
-    int retryInterval;
-    int sleepInterval = DEFAULT_SLEEP_INTERVAL;        /* seconds        */
-    BOOLEAN afsWillAutoStart;
-       CHAR RandomName[MAXRANDOMNAMELEN];
+
+       BOOLEAN afsWillAutoStart;
+
     BOOLEAN uppercased_name = TRUE;
 
+       LogonOptions_t opt; /* domain specific logon options */
+       int retryInterval;
+       int sleepInterval;
+
     /* Initialize Logon Script to none */
        *lpLogonScript=NULL;
-        
+    
+       /* TODO: We should check the value of lpAuthentInfoType before assuming that it is
+                MSV1_0_INTERACTIVE_LOGON though for our purposes KERB_INTERACTIVE_LOGON is
+                        co-incidentally equivalent. */
        IL = (MSV1_0_INTERACTIVE_LOGON *) lpAuthentInfo;
 
        /* Are we interactive? */
        interactive = (wcscmp(lpStationName, L"WinSta0") == 0);
 
        /* Convert from Unicode to ANSI */
+
+       /*TODO: Use SecureZeroMemory to erase passwords */
        UnicodeStringToANSI(IL->UserName, uname, 256);
        UnicodeStringToANSI(IL->Password, password, 256);
+       UnicodeStringToANSI(IL->LogonDomainName, logonDomain, 256);
 
        /* Make sure AD-DOMANS sent from login that is sent to us is striped */
     ctemp = strchr(uname, '@');
@@ -395,42 +573,38 @@ DWORD APIENTRY NPLogonNotify(
        (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY,
                         0, KEY_QUERY_VALUE, &NPKey);
        LSPsize=sizeof(TraceOption);
-       RegQueryValueEx(NPKey, "TraceOption", NULL,
+       RegQueryValueEx(NPKey, REG_CLIENT_TRACE_OPTION_PARM, NULL,
                      &LSPtype, (LPBYTE)&TraceOption, &LSPsize);
-    RegCloseKey (NPKey);
-       
+
+       RegCloseKey (NPKey);
+
        /*
-        * Get Logon OPTIONS
+        * Get Logon options
         */
 
-       (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY,
-                         0, KEY_QUERY_VALUE, &NPKey);
+       GetDomainLogonOptions( lpLogonId, uname, logonDomain, &opt );
+       retryInterval = opt.retryInterval;
+       sleepInterval = opt.sleepInterval;
+       *lpLogonScript = opt.logonScript;
 
-       LSPsize=sizeof(LogonOption);
-       code = RegQueryValueEx(NPKey, "LogonOptions", NULL,
-                            &LSPtype, (LPBYTE)&LogonOption, &LSPsize);
-
-       RegCloseKey (NPKey);
-       if ((code!=0) || (LSPtype!=REG_DWORD))
-               LogonOption=LOGON_OPTION_INTEGRATED;    /*default to integrated logon only*/
+       DebugEvent(NULL,"Got logon script: %S",opt.logonScript);
 
        afsWillAutoStart = AFSWillAutoStart();
-        
+
        DebugEvent("AFS AfsLogon - NPLogonNotify","LogonOption[%x], Service AutoStart[%d]",
-                LogonOption,afsWillAutoStart);
+                opt.LogonOption,afsWillAutoStart);
     
-    /* Get local machine specified login behavior (or defaults) */
-    GetLoginBehavior(&retryInterval, &failSilently);
-        
     /* Check for zero length password if integrated logon*/
-       if ( ISLOGONINTEGRATED(LogonOption) )  {
+       if ( ISLOGONINTEGRATED(opt.LogonOption) )  {
         if ( password[0] == 0 ) {
             code = GT_PW_NULL;
             reason = "zero length password is illegal";
             code=0;
         }
 
-        /* Get cell name if doing integrated logon */
+        /* Get cell name if doing integrated logon.  
+                  We might overwrite this if we are logging into an AD realm and we find out that
+                  the user's home dir is in some other cell. */
                code = cm_GetRootCellName(cell);
                if (code < 0) { 
                        code = KTC_NOCELL;
@@ -438,30 +612,40 @@ DWORD APIENTRY NPLogonNotify(
                        code=0;
                }
 
-        /*only do if high security option is on*/
-        if (ISHIGHSECURITY(LogonOption))
-            *lpLogonScript = GetLogonScript(GenRandomName(RandomName));        
+               /* We get the user's home directory path, if applicable, though we can't lookup the
+                  cell right away because the client service may not have started yet. This call
+                  also sets the AD_REALM flag in opt.flags if applicable. */
+               if(ISREMOTE(opt.flags))
+                       GetAdHomePath(homePath,MAX_PATH,lpLogonId,IL,&opt);
     }
 
     /* loop until AFS is started. */
     while (TRUE) {
-        code=0;
+               if(ISADREALM(opt.flags)) {
+                       code = GetFileCellName(homePath,cell,256);
+                       if(!code) {
+                               DebugEvent(NULL,"profile path [%s] is in cell [%s]",homePath,cell);
+                       }
+                       /* Don't bail out if GetFileCellName failed.
+                        * The home dir may not be in AFS after all. 
+                        */
+               } else
+               code=0;
                
-        /* is service started yet?*/
-        DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s]",
-                   code,uname,cell);
-
-        /* if Integrated Logon only */
-        if (ISLOGONINTEGRATED(LogonOption) && !ISHIGHSECURITY(LogonOption))
+        /* if Integrated Logon  */
+        if (ISLOGONINTEGRATED(opt.LogonOption))
                {                       
-            if ( KFW_is_available() )
-                code = KFW_AFS_get_cred(uname, cell, password, 0, uname, &reason);
-            else
+                       if ( KFW_is_available() ) {
+                code = KFW_AFS_get_cred(uname, cell, password, 0, opt.smbName, &reason);
+                               DebugEvent(NULL,"KFW_AFS_get_cred  uname=[%s] smbname=[%s] cell=[%s] code=[%d]",uname,opt.smbName,cell,code);
+                       }
+                       else {
                 code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
-                                                uname, "", cell, password, uname, 0, &pw_exp, 0,
+                                                uname, "", cell, password, opt.smbName, 0, &pw_exp, 0,
                                                 &reason);
-                       DebugEvent("AFS AfsLogon - (INTEGRATED only)ka_UserAuthenticateGeneral2","Code[%x]",
-                        code);
+                               DebugEvent("AFS AfsLogon - (INTEGRATED only)ka_UserAuthenticateGeneral2","Code[%x]",
+                                                       code);
+                       }
             if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && uppercased_name ) {
                 for ( ctemp = uname; *ctemp ; ctemp++) {
                     *ctemp = tolower(*ctemp);
@@ -469,27 +653,8 @@ DWORD APIENTRY NPLogonNotify(
                 uppercased_name = FALSE;
                 continue;
             }
-               } 
-        /* if Integrated Logon and High Security pass random generated name*/
-        else if (ISLOGONINTEGRATED(LogonOption) && ISHIGHSECURITY(LogonOption))
-               {
-            if ( KFW_is_available() )
-                code = KFW_AFS_get_cred(uname, cell, password, 0, RandomName, &reason);
-            else
-                code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
-                                                uname, "", cell, password,RandomName, 0, &pw_exp, 0,
-                                                &reason);
-                       DebugEvent("AFS AfsLogon - (Both)ka_UserAuthenticateGeneral2","Code[%x] RandomName[%s]",
-                       code, RandomName);
-
-            if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && uppercased_name ) {
-                for ( ctemp = uname; *ctemp ; ctemp++) {
-                    *ctemp = tolower(*ctemp);
-                }
-                uppercased_name = FALSE;
-                continue;
-            }
-               } else {  
+               }
+               else {  
             /*JUST check to see if its running*/
                    if (IsServiceRunning())
                 break;
@@ -498,6 +663,10 @@ DWORD APIENTRY NPLogonNotify(
                 break;
                }
 
+               /* is service started yet?*/
+        DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s]",
+                   code,uname,cell);
+
                /* If we've failed because the client isn't running yet and the
          * client is set to autostart (and therefore it makes sense for
          * us to wait for it to start) then sleep a while and try again. 
@@ -511,7 +680,7 @@ DWORD APIENTRY NPLogonNotify(
          * user know we failed and give them a chance to try again. */
         if (retryInterval <= 0) {
             reason = "AFS not running";
-            if (!interactive || failSilently)
+            if (!interactive || opt.failSilently)
                 break;
                        flag = MessageBox(hwndOwner,
                                "AFS is still starting.  Retry?",
@@ -540,7 +709,7 @@ DWORD APIENTRY NPLogonNotify(
         char msg[128];
         sprintf(msg, "Integrated login failed: %s", reason);
 
-               if (interactive && !failSilently)
+               if (interactive && !opt.failSilently)
                        MessageBox(hwndOwner, msg, "AFS Logon", MB_OK);
                else {
             HANDLE h;
@@ -566,6 +735,8 @@ DWORD APIENTRY NPLogonNotify(
                }
        }
 
+       if(opt.smbName) free(opt.smbName);
+
        DebugEvent("AFS AfsLogon - Exit","Return Code[%x]",code);
        return code;
 }
diff --git a/src/WINNT/afsd/afslogon.h b/src/WINNT/afsd/afslogon.h
new file mode 100644 (file)
index 0000000..b4a7139
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+
+Copyright 2004 by the Massachusetts Institute of Technology
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the Massachusetts
+Institute of Technology (M.I.T.) not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+/* We only support VC 1200 and above anyway */
+#pragma once
+
+#include <windows.h>
+#include <npapi.h>
+#include <ntsecapi.h>
+#include <strsafe.h>
+
+
+#define REG_CLIENT_PARMS_KEY            "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"
+#define REG_CLIENT_PROVIDER_KEY                        "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider"
+#define REG_CLIENT_DOMAINS_SUBKEY              "Domain"
+#define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
+#define REG_CLIENT_SLEEP_INTERVAL_PARM "LoginSleepInterval"
+#define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
+#define REG_CLIENT_TRACE_OPTION_PARM   "TraceOption"
+#define REG_CLIENT_LOGON_OPTION_PARM   "LogonOptions"
+#define REG_CLIENT_LOGON_SCRIPT_PARMW  L"LogonScript"
+#define DEFAULT_RETRY_INTERVAL          30                        /* seconds*/
+#define DEFAULT_FAIL_SILENTLY           FALSE
+#define DEFAULT_SLEEP_INTERVAL          5                         /* seconds*/
+#define DEFAULT_LOGON_OPTION                   1
+
+#define TRACE_OPTION_EVENT 1
+
+#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
+
+#define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED)
+#define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY)
+
+#define ISREMOTE(v) ( ((v) & LOGON_FLAG_REMOTE)==LOGON_FLAG_REMOTE)
+#define ISADREALM(v) ( ((v) & LOGON_FLAG_AD_REALM)==LOGON_FLAG_AD_REALM)
+extern DWORD TraceOption;
+
+#define LOGON_FLAG_LOCAL       0
+#define LOGON_FLAG_REMOTE      1
+#define LOGON_FLAG_AD_REALM 2
+
+typedef struct LogonOptions_type {
+       DWORD   LogonOption;
+       BOOLEAN failSilently;
+       int             retryInterval;
+       int             sleepInterval;
+       char *  smbName;
+       LPWSTR  logonScript;
+       DWORD   flags; /* LOGON_FLAG_* */
+} LogonOptions_t;
+
+/* */
+#define MAX_USERNAME_LENGTH 256
+#define MAX_PASSWORD_LENGTH 256
+#define MAX_DOMAIN_LENGTH 256
+
+BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved);
+
+DWORD APIENTRY NPGetCaps(DWORD index);
+
+DWORD APIENTRY NPLogonNotify(
+       PLUID lpLogonId,
+       LPCWSTR lpAuthentInfoType,
+       LPVOID lpAuthentInfo,
+       LPCWSTR lpPreviousAuthentInfoType,
+       LPVOID lpPreviousAuthentInfo,
+       LPWSTR lpStationName,
+       LPVOID StationHandle,
+       LPWSTR *lpLogonScript);
+
+DWORD APIENTRY NPPasswordChangeNotify(
+       LPCWSTR lpAuthentInfoType,
+       LPVOID lpAuthentInfo,
+       LPCWSTR lpPreviousAuthentInfoType,
+       LPVOID lpPreviousAuthentInfo,
+       LPWSTR lpStationName,
+       LPVOID StationHandle,
+       DWORD dwChangeInfo);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void DebugEvent0(char *a);
+void DebugEvent(char *a,char *b,...);
+
+CHAR *GenRandomName(CHAR *pbuf);
+
+BOOLEAN AFSWillAutoStart(void);
+
+DWORD MapAuthError(DWORD code);
+
+BOOL IsServiceRunning (void);
+
+static BOOL WINAPI UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen);
+
+void GetDomainLogonOptions( PLUID lpLogonId, char * username, char * domain, LogonOptions_t *opt );
+DWORD GetFileCellName(char * path, char * cell, size_t cellLen);
+DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, MSV1_0_INTERACTIVE_LOGON * IL, LogonOptions_t * opt);
+
+#ifdef __cplusplus
+}
+#endif
index b001ade..c88dd90 100644 (file)
@@ -1691,7 +1691,8 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
         if (flags & PIOCTL_LOGON) {
                  /* SMB user name with which to associate tokens */
                  smbname = tp;
-                 fprintf(stderr, "SMB name = %s\n", smbname);
+          osi_Log1(smb_logp,"cm_IoctlSetToken for user [%s]",osi_LogSaveString(smb_logp,smbname));               
+          fprintf(stderr, "SMB name = %s\n", smbname);
                  tp += strlen(tp) + 1;
         }
 
index 8c60896..027a566 100644 (file)
@@ -164,7 +164,7 @@ void OutputDebugHexDump(unsigned char * buffer, int len) {
 #define SMB_EXT_SEC_PACKAGE_NAME "Negotiate"
 void smb_NegotiateExtendedSecurity(void ** secBlob, int * secBlobLength){
     SECURITY_STATUS status, istatus;
-       CredHandle creds;
+       CredHandle creds = {0,0};
        TimeStamp expiry;
        SecBufferDesc secOut;
        SecBuffer secTok;
@@ -233,19 +233,15 @@ void smb_NegotiateExtendedSecurity(void ** secBlob, int * secBlobLength){
             OutputDebugF("AcceptSecurityContext status != CONTINUE  %lX", status);
     }
 
+    /* Discard partial security context */
+    DeleteSecurityContext(&ctx);
+
        if (secTok.pvBuffer) FreeContextBuffer( secTok.pvBuffer );
 
        /* Discard credentials handle.  We'll reacquire one when we get the session setup X */
        FreeCredentialsHandle(&creds);
 
   nes_0:
-
-    if (secBlob) {
-        OutputDebugF("Returning initial token:");
-        OutputDebugHexDump(*secBlob,*secBlobLength);
-    } else {
-        OutputDebugF("No initial token");
-    }
        return;
 }
 
@@ -514,11 +510,6 @@ long smb_AuthenticateUserLM(smb_vc_t *vcp, char * accountName, char * primaryDom
        OutputDebugF("In smb_AuthenticateUser for user [%s] domain [%s]", accountName, primaryDomain);
        OutputDebugF("ciPwdLength is %d and csPwdLength is %d", ciPwdLength, csPwdLength);
 
-    OutputDebugF("csPassword:");
-    OutputDebugHexDump(csPwd,csPwdLength);
-    OutputDebugF("ciPassword:");
-    OutputDebugHexDump(ciPwd,ciPwdLength);
-
        if (ciPwdLength > P_RESP_LEN || csPwdLength > P_RESP_LEN) {
                OutputDebugF("ciPwdLength or csPwdLength is too long");
                return CM_ERROR_BADPASSWORD;
@@ -3975,6 +3966,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
 
     osi_Log1(smb_logp,"NTCreateX for [%s]",osi_LogSaveString(smb_logp,realPathp));
     osi_Log4(smb_logp,"NTCreateX da=[%x] ea=[%x] cd=[%x] co=[%x]", desiredAccess, extAttributes, createDisp, createOptions);
+    osi_Log1(smb_logp,"NTCreateX lastNamep=[%s]",osi_LogSaveString(smb_logp,(lastNamep?lastNamep:"null")));
 
        if (lastNamep && strcmp(lastNamep, SMB_IOCTL_FILENAME) == 0) {
                /* special case magic file name for receiving IOCTL requests
@@ -3982,6 +3974,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
                 */
                fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE);
                smb_SetupIoctlFid(fidp, spacep);
+               osi_Log1(smb_logp,"NTCreateX Setting up IOCTL on fid[%d]",fidp->fid);
 
                /* set inp->fid so that later read calls in same msg can find fid */
                inp->fid = fidp->fid;
@@ -5090,6 +5083,9 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter,
                otherAction = FILE_ACTION_RENAMED_NEW_NAME;
        }
 
+    osi_Log2(smb_logp,"in smb_NotifyChange for file [%s] dscp [%x]",
+              osi_LogSaveString(smb_logp,filename),dscp);
+
        lock_ObtainMutex(&smb_Dir_Watch_Lock);
        watch = smb_Directory_Watches;
        while (watch) {
@@ -5110,6 +5106,7 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter,
 
                fidp = smb_FindFID(vcp, fid, 0);
         if (!fidp) {
+            osi_Log1(smb_logp," no fidp for fid[%d]",fid);
                lastWatch = watch;
                watch = watch->nextp;
                continue;
@@ -5117,7 +5114,8 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter,
                if (fidp->scp != dscp
                    || (filter & notifyFilter) == 0
                    || (!isDirectParent && !wtree)) {
-                       smb_ReleaseFID(fidp);
+            osi_Log1(smb_logp," passing fidp->scp[%x]", fidp->scp);
+            smb_ReleaseFID(fidp);
                        lastWatch = watch;
                        watch = watch->nextp;
                        continue;
@@ -5324,9 +5322,11 @@ cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine)
         lock_ObtainMutex(&unp->mx);
         unp->userp = cm_NewUser();
         lock_ReleaseMutex(&unp->mx);
-               osi_LogEvent("AFS smb_FindCMUserByName : New User",NULL,"name[%s] machine[%s]",usern,machine);
+               osi_Log2(smb_logp,"smb_FindCMUserByName New user name[%s] machine[%s]",osi_LogSaveString(smb_logp,usern),osi_LogSaveString(smb_logp,machine));
+        osi_LogEvent("AFS smb_FindCMUserByName : New User",NULL,"name[%s] machine[%s]",usern,machine);
     }  else    {
-               osi_LogEvent("AFS smb_FindCMUserByName : Found",NULL,"name[%s] machine[%s]",usern,machine);
+        osi_Log2(smb_logp,"smb_FindCMUserByName Not found name[%s] machine[%s]",osi_LogSaveString(smb_logp,usern),osi_LogSaveString(smb_logp,machine));
+        osi_LogEvent("AFS smb_FindCMUserByName : Found",NULL,"name[%s] machine[%s]",usern,machine);
        }
     return unp->userp;
 }
index 8da96f1..e8ca29b 100644 (file)
@@ -16,3 +16,4 @@
 #include "..\..\config\NTVersioninfo.rc"
 
 IDI_AFSD                ICON    DISCARDABLE     "afs_conf.ico"
+IDI_CCENTER                    ICON    DISCARDABLE         "afs_ccenter.ico"
index abf5380..848a316 100644 (file)
@@ -69,6 +69,7 @@ static BOOL IsClientInstalled (void)
 extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2)
 {
     LPNEWCPLINFO lpNewCPlInfo;
+    LPCPLINFO lpCPlInfo;
 
     switch (uMsg) {
         case CPL_INIT:      /* first message, sent once  */
@@ -80,6 +81,14 @@ extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG l
             return 1;
             break;
 
+        case CPL_INQUIRE:  /* in case we receive this we should indicate that we like NEWINQUIRE better. */
+                       lpCPlInfo = (CPLINFO *) lParam2;
+                       lpCPlInfo->idIcon = ((IsClientInstalled() || !IsWindowsNT())? IDI_AFSD : IDI_CCENTER);
+                       lpCPlInfo->idName = CPL_DYNAMIC_RES;
+                       lpCPlInfo->idInfo = CPL_DYNAMIC_RES;
+                       lpCPlInfo->lData = 0;
+                       break;
+
         case CPL_NEWINQUIRE: /* third message, sent once per app */
             lpNewCPlInfo = (LPNEWCPLINFO) lParam2;
 
index 43390d5..6935065 100644 (file)
@@ -345,7 +345,6 @@ void WizCreds_OnInitDialog (HWND hDlg)
    HKEY hk;
 
    TCHAR szCell[ cchRESOURCE ] = TEXT("");
-   (void)GetDefaultCell (szCell);
    SetDlgItemText (hDlg, IDC_NEWCREDS_CELL, szCell);
 
    TCHAR szUser[ cchRESOURCE ] = TEXT("");
index 59cca63..f8b58ae 100644 (file)
@@ -437,22 +437,34 @@ int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword,
 
 int GetDefaultCell (LPTSTR pszCell)
 {
-   int rc = KTC_NOCM;
-   *pszCell = TEXT('\0');
-
-   if (!Creds_OpenLibraries())
-      {
-      rc = ERROR_DLL_INIT_FAILED;
-      }
-   else if (IsServiceRunning())
-      {
-      char szCellA[ 256 ];
-
-      int rc;
-      if ((rc = cm_GetRootCellName (szCellA)) == 0)
-         CopyAnsiToString (pszCell, szCellA);
-      }
-
-   return rc;
+    int rc = KTC_NOCM;
+    *pszCell = TEXT('\0');
+
+    if (!Creds_OpenLibraries())
+    {
+        rc = ERROR_DLL_INIT_FAILED;
+    }
+    else if (IsServiceRunning())
+    {
+        char szCellA[ 256 ] = "";
+        int rc;
+        HKEY hk;
+
+        if (RegOpenKey (HKEY_CURRENT_USER, REGSTR_PATH_OPENAFS_CLIENT, &hk) == 0)
+        {
+            DWORD dwSize = sizeof(szCellA);
+            DWORD dwType = REG_SZ;
+            RegQueryValueEx (hk, TEXT("Authentication Cell"), NULL, &dwType, (PBYTE)szCellA, &dwSize);
+            RegCloseKey (hk);
+        }
+
+        if (szCellA[0] == '\0') {
+            if ((rc = cm_GetRootCellName (szCellA)) == 0)
+                CopyAnsiToString (pszCell, szCellA);
+        } else {
+            rc = 0;
+        }
+    }
+    return rc;
 }
 
index ea5853f..b9921cd 100644 (file)
 
 #define VC_EXTRALEAN           // Exclude rarely-used stuff from Windows headers
 
+// Don't include stuff we don't need.
+#define _AFX_NO_DB_SUPPORT
+#define _AFX_NO_DAO_SUPPORT
+
 #include <afxwin.h>         // MFC core and standard components
 #include <afxext.h>         // MFC extensions
 
index 6d43dc8..7b320be 100644 (file)
@@ -1,4 +1,4 @@
->grand.central.org      #GCO Public CellServDB 11 May 2004
+>grand.central.org      #GCO Public CellServDB 29 Jun 2004
 18.7.14.88                      #grand-opening.mit.edu
 128.2.191.224                   #penn.central.org
 >wu-wien.ac.at          #University of Economics, Vienna, Austria
 134.109.200.7                   #aetius.hrz.tu-chemnitz.de
 >e18.ph.tum.de          #Experimental Physics, TU Munich, Germany
 129.187.154.223                 #hamlet.e18.physik.tu-muenchen.de
->uni-bonn.de            #Cell name
+>uni-bonn.de            #University of Bonn, Computing Center
 131.220.14.198                  #work15-eth.rhrz.uni-bonn.de
-131.220.14.203                  #node03-en2.rhrz.uni-bonn.de
 131.220.14.205                  #node05.rhrz.uni-bonn.de
+131.220.15.197                  #afs-db1.rhrz.uni-bonn.de
+>atlass01.physik.uni-bonn.de #Bonn ATLAS
+131.220.165.43                  #atlass01.physik.uni-bonn.de
 >uni-freiburg.de        #Albert-Ludwigs-Universitat Freiburg
 132.230.6.235                   #sv6.ruf.uni-freiburg.de
 132.230.6.236                   #sv7.ruf.uni-freiburg.de
 >physik.uni-mainz.de    #institute of physics, university Mainz, Germany
 134.93.130.93                   #hardy.physik.uni-mainz.de
 >uni-mannheim.de        #Uni Mannheim (Rechenzentrum)
-134.155.50.165                  #afsdbx.uni-mannheim.de
-134.155.50.166                  #afsdby.uni-mannheim.de
-134.155.50.167                  #afsdbz.uni-mannheim.de
+134.155.97.204                  #afsdb1.uni-mannheim.de
+134.155.97.205                  #afsdb2.uni-mannheim.de
+134.155.97.206                  #afsdb3.uni-mannheim.de
 >physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal
 132.195.104.3                   #afs1.physik.uni-wuppertal.de
 132.195.104.230                 #afs2.physik.uni-wuppertal.de
 130.225.51.73                   #afsdb1.kom.auc.dk
 130.225.51.74                   #afsdb2.kom.auc.dk
 130.225.51.85                   #afsdb3.kom.auc.dk
+>asu.edu                #Arizona State University
+129.219.10.69                   #authen2.asu.edu
+129.219.10.70                   #authen1.asu.edu
+129.219.10.72                   #authen3.asu.edu
+129.219.100.16                  #authen4.asu.edu
 >hep.caltech.edu        #CalTech High Energy Physics
 131.215.126.150                 #afs.hep.caltech.edu
 >andrew.cmu.edu         #Carnegie Mellon University - Computing Services Cell
 128.2.129.9                     #e-xing.ece.cmu.edu
 >scotch.ece.cmu.edu     #CMU ECE CALCM research group
 128.2.134.82                    #lagavulin.ece.cmu.edu
+>qatar.cmu.edu          #Carnegie Mellon University - Qatar Campus Cell
+204.194.25.7                    #afs1.qatar.cmu.edu
+204.194.25.8                    #afs2.qatar.cmu.edu
 >msc.cornell.edu        #Cornell University Materials Science Center
 128.84.231.242                  #miranda.ccmr.cornell.edu
 128.84.241.35                   #co.ccmr.cornell.edu
 >ncsa.uiuc.edu          #University of Illinois
 141.142.3.5                     #congo.ncsa.uiuc.edu
 141.142.3.8                     #nile.ncsa.uiuc.edu
-141.142.230.19                  #jinx.ncsa.uiuc.edu
+141.142.3.9                     #kaskaskia.ncsa.uiuc.edu
 >umbc.edu               #University of Maryland, Baltimore County
 130.85.24.23                    #db2.afs.umbc.edu
 130.85.24.87                    #db3.afs.umbc.edu
 141.211.133.5                   #babylon.citi.umich.edu
 >lsa.umich.edu          #University of Michigan - College of LS&A
 141.211.54.132                  #curtis.admin.lsa.umich.edu
-141.211.61.23                   #zee.admin.lsa.umich.edu
-141.211.68.15                   #marshall.lsa.umich.edu
+141.211.211.53                  #gerow.lsa.umich.edu
+141.211.211.72                  #collines.lsa.umich.edu
+141.211.211.153                 #hodges.lsa.umich.edu
 >math.lsa.umich.edu     #University of Michigan - Math Department
 141.211.61.40                   #ike.math.lsa.umich.edu
 141.211.61.41                   #clark.math.lsa.umich.edu
 >dementia.org           #Dementia Unlimited
 128.2.12.45                     #alycia.dementia.org
 128.2.120.216                   #meredith.dementia.org
+>hackish.org            #Hackish.org
+24.167.65.213                   #avatar.sys.hackish.org
+128.2.120.138                   #kurma.sys.hackish.org
 >idahofuturetruck.org   #University of Idaho hybrid vehicle development
 12.18.238.210                   #dsle210.fsr.net
 >nimlabs.org            #Nimlabs, Ink. Cell.
 18.238.1.105                    #caerbanog.nimlabs.org
 >nomh.org               #nomh.org
 204.29.154.12                   #iota.nomh.org
+204.29.154.32                   #adversity.xi.nomh.org
 >oc7.org                #The OC7 Project
 128.2.6.107                     #vice3.oc7.org
 128.2.122.140                   #vice2.oc7.org
 130.237.57.72                   #morpheus.md.kth.se
 130.237.67.230                  #neo.speech.kth.se
 >mech.kth.se            #Royal Institute of Technology, MECH
-130.237.233.142                 #matterhorn.mech.kth.se
 130.237.233.143                 #castor.mech.kth.se
 130.237.233.144                 #pollux.mech.kth.se
 >nada.kth.se            #Royal Institute of Technology, NADA
 >su.se                  #Stockholm University
 130.237.162.81                  #afsdb1.su.se
 130.237.162.82                  #afsdb2.su.se
+130.237.162.230                 #afsdb3.su.se
 >f9.ijs.si              #F9, Jozef Stefan Institue
 194.249.156.1                   #brenta.ijs.si
 >p-ng.si                #Nova Gorica Polytechnic
index 7ec3e4b..b3eebe3 100644 (file)
@@ -696,14 +696,17 @@ extern "C" void SetMsiReporter(LPCSTR strAction, LPCSTR strDesc,DWORD h) {
        dwReporterType = REPORT_MSI;
        hMsiHandle = h;
 
+#ifdef DONT_NEED
+    /* this is performed in the Wix installer */
        MSIHANDLE hRec = MsiCreateRecord(4);
-       
-       MsiRecordClearData(hRec);
+  
+    MsiRecordClearData(hRec);
        MsiRecordSetStringA(hRec,1,strAction);
        MsiRecordSetStringA(hRec,2,strDesc);
        MsiRecordSetStringA(hRec,3,"[1]:([2])([3])([4])");
 
        MsiProcessMessage(h,INSTALLMESSAGE_ACTIONSTART, hRec);
-
-       MsiCloseHandle(hRec);
+       
+    MsiCloseHandle(hRec);
+#endif
 }
index 6d43dc8..7b320be 100644 (file)
@@ -1,4 +1,4 @@
->grand.central.org      #GCO Public CellServDB 11 May 2004
+>grand.central.org      #GCO Public CellServDB 29 Jun 2004
 18.7.14.88                      #grand-opening.mit.edu
 128.2.191.224                   #penn.central.org
 >wu-wien.ac.at          #University of Economics, Vienna, Austria
 134.109.200.7                   #aetius.hrz.tu-chemnitz.de
 >e18.ph.tum.de          #Experimental Physics, TU Munich, Germany
 129.187.154.223                 #hamlet.e18.physik.tu-muenchen.de
->uni-bonn.de            #Cell name
+>uni-bonn.de            #University of Bonn, Computing Center
 131.220.14.198                  #work15-eth.rhrz.uni-bonn.de
-131.220.14.203                  #node03-en2.rhrz.uni-bonn.de
 131.220.14.205                  #node05.rhrz.uni-bonn.de
+131.220.15.197                  #afs-db1.rhrz.uni-bonn.de
+>atlass01.physik.uni-bonn.de #Bonn ATLAS
+131.220.165.43                  #atlass01.physik.uni-bonn.de
 >uni-freiburg.de        #Albert-Ludwigs-Universitat Freiburg
 132.230.6.235                   #sv6.ruf.uni-freiburg.de
 132.230.6.236                   #sv7.ruf.uni-freiburg.de
 >physik.uni-mainz.de    #institute of physics, university Mainz, Germany
 134.93.130.93                   #hardy.physik.uni-mainz.de
 >uni-mannheim.de        #Uni Mannheim (Rechenzentrum)
-134.155.50.165                  #afsdbx.uni-mannheim.de
-134.155.50.166                  #afsdby.uni-mannheim.de
-134.155.50.167                  #afsdbz.uni-mannheim.de
+134.155.97.204                  #afsdb1.uni-mannheim.de
+134.155.97.205                  #afsdb2.uni-mannheim.de
+134.155.97.206                  #afsdb3.uni-mannheim.de
 >physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal
 132.195.104.3                   #afs1.physik.uni-wuppertal.de
 132.195.104.230                 #afs2.physik.uni-wuppertal.de
 130.225.51.73                   #afsdb1.kom.auc.dk
 130.225.51.74                   #afsdb2.kom.auc.dk
 130.225.51.85                   #afsdb3.kom.auc.dk
+>asu.edu                #Arizona State University
+129.219.10.69                   #authen2.asu.edu
+129.219.10.70                   #authen1.asu.edu
+129.219.10.72                   #authen3.asu.edu
+129.219.100.16                  #authen4.asu.edu
 >hep.caltech.edu        #CalTech High Energy Physics
 131.215.126.150                 #afs.hep.caltech.edu
 >andrew.cmu.edu         #Carnegie Mellon University - Computing Services Cell
 128.2.129.9                     #e-xing.ece.cmu.edu
 >scotch.ece.cmu.edu     #CMU ECE CALCM research group
 128.2.134.82                    #lagavulin.ece.cmu.edu
+>qatar.cmu.edu          #Carnegie Mellon University - Qatar Campus Cell
+204.194.25.7                    #afs1.qatar.cmu.edu
+204.194.25.8                    #afs2.qatar.cmu.edu
 >msc.cornell.edu        #Cornell University Materials Science Center
 128.84.231.242                  #miranda.ccmr.cornell.edu
 128.84.241.35                   #co.ccmr.cornell.edu
 >ncsa.uiuc.edu          #University of Illinois
 141.142.3.5                     #congo.ncsa.uiuc.edu
 141.142.3.8                     #nile.ncsa.uiuc.edu
-141.142.230.19                  #jinx.ncsa.uiuc.edu
+141.142.3.9                     #kaskaskia.ncsa.uiuc.edu
 >umbc.edu               #University of Maryland, Baltimore County
 130.85.24.23                    #db2.afs.umbc.edu
 130.85.24.87                    #db3.afs.umbc.edu
 141.211.133.5                   #babylon.citi.umich.edu
 >lsa.umich.edu          #University of Michigan - College of LS&A
 141.211.54.132                  #curtis.admin.lsa.umich.edu
-141.211.61.23                   #zee.admin.lsa.umich.edu
-141.211.68.15                   #marshall.lsa.umich.edu
+141.211.211.53                  #gerow.lsa.umich.edu
+141.211.211.72                  #collines.lsa.umich.edu
+141.211.211.153                 #hodges.lsa.umich.edu
 >math.lsa.umich.edu     #University of Michigan - Math Department
 141.211.61.40                   #ike.math.lsa.umich.edu
 141.211.61.41                   #clark.math.lsa.umich.edu
 >dementia.org           #Dementia Unlimited
 128.2.12.45                     #alycia.dementia.org
 128.2.120.216                   #meredith.dementia.org
+>hackish.org            #Hackish.org
+24.167.65.213                   #avatar.sys.hackish.org
+128.2.120.138                   #kurma.sys.hackish.org
 >idahofuturetruck.org   #University of Idaho hybrid vehicle development
 12.18.238.210                   #dsle210.fsr.net
 >nimlabs.org            #Nimlabs, Ink. Cell.
 18.238.1.105                    #caerbanog.nimlabs.org
 >nomh.org               #nomh.org
 204.29.154.12                   #iota.nomh.org
+204.29.154.32                   #adversity.xi.nomh.org
 >oc7.org                #The OC7 Project
 128.2.6.107                     #vice3.oc7.org
 128.2.122.140                   #vice2.oc7.org
 130.237.57.72                   #morpheus.md.kth.se
 130.237.67.230                  #neo.speech.kth.se
 >mech.kth.se            #Royal Institute of Technology, MECH
-130.237.233.142                 #matterhorn.mech.kth.se
 130.237.233.143                 #castor.mech.kth.se
 130.237.233.144                 #pollux.mech.kth.se
 >nada.kth.se            #Royal Institute of Technology, NADA
 >su.se                  #Stockholm University
 130.237.162.81                  #afsdb1.su.se
 130.237.162.82                  #afsdb2.su.se
+130.237.162.230                 #afsdb3.su.se
 >f9.ijs.si              #F9, Jozef Stefan Institue
 194.249.156.1                   #brenta.ijs.si
 >p-ng.si                #Nova Gorica Polytechnic
index 7a56537..8bfe8ce 100644 (file)
@@ -39,6 +39,7 @@
                     <ComponentRef Id="cmp_ClientProgramDebug" />
                     <ComponentRef Id="cmp_CommonCommonDebug" />
                     <ComponentRef Id="cmp_ClientCommonDebug" />
+                    <ComponentRef Id="cmp_ClientSystemDebug" />
                     <?include runtime_debug.wxi?>
                                </Feature>
                        <?endif?>
@@ -47,7 +48,7 @@
                                <ComponentRef Id="cmp_CommonDir" />
 
                 <ComponentRef Id="efl_Readme_TXT_$(var.Language)" />
-                <ComponentRef Id="efl_afsdcell_INI" />
+                <ComponentRef Id="efl_CellServDB" />
                 <ComponentRef Id="cmf_afs_cpa_CPL" />
 
                 <ComponentRef Id="cmf_afsrpc_DLL" />
index c87a2d8..c4f5fc5 100644 (file)
@@ -1,9 +1,22 @@
 <?xml version="1.0"?>
 <Include>
-    <Directory Id="WindowsFolder" Name="Windows">
-        <Component Id="efl_afsdcell_INI" Guid="009F9A2D-5B53-4449-824F-7B063AF6F81C" Permanent="yes" NeverOverwrite="yes">
-            <File Id="file_afsdcell_INI" Name="afsdcell.ini" LongName="afsdcell.ini" KeyPath="yes" DiskId="1" src="$(var.CellDbFile)"/>
+    <Directory Id="WindowsFolder">
+    </Directory>
+    <Directory Id="SystemFolder">
+        <Component Id="cmf_afslogon_DLL" Guid="123197FE-4F53-4035-8D51-FCFB6B50A777">
+            <File Id="fileafslogon_DLL" Name="afslogon.dll" LongName="afslogon.dll" KeyPath="yes" DiskId="1" src="$(var.ClientDir)afslogon.dll" />
+            <Registry Id="reg_afslogon01" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="*" />
+            <Registry Id="reg_afslogon02" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" />
+            <Registry Id="reg_afslogon03" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Asynchronous" Value="0" Type="integer" />
+            <Registry Id="reg_afslogon04" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Impersonate" Value="1" Type="integer" />
+            <Registry Id="reg_afslogon05" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="DLLName" Value="#fileafslogon_DLL" />
+            <Registry Id="reg_afslogon06" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logoff" Value="AFS_Logoff_Event" />
+        </Component>
+    <?ifdef DebugSyms?>
+        <Component Id="cmp_ClientSystemDebug" Guid="DD34DA09-D9DA-4A5A-9521-87B7738A7D53">
+                       <File Id="fileafslogon_PDB" Name="afslogon.pdb" LongName="afslogon.pdb" KeyPath="yes" DiskId="1" src="$(var.ClientDir)afslogon.pdb" />
         </Component>
+    <?endif?>
     </Directory>
     <Directory Id="ProgramFilesFolder" Name=".">
         <Directory Id="AFSDIR" Name="OpenAFS" SourceName=".">
             </Directory> <!-- Documentation -->
 
             <Directory Id="dirClient" Name="Client" LongName="Client" SourceName=".">
+                <Component Id="efl_CellServDB" Guid="8E69FDAB-08C5-4927-B1AA-57FCEEB065F2">
+                    <File Id="file_CellServDB" Name="CelSrvDB" LongName="CellServDB" KeyPath="yes" DiskId="1" src="$(var.CellDbFile)"/>
+                    <CopyFile Id="copy_CellServDB" Delete="yes" DestinationFolder="dirClient" SourceFolder="WindowsFolder" SourceName="afsdcell.ini" />
+                </Component>
                 <Directory Id="dirProgram" Name="Program" LongName="Program" SourceName="." src="$(var.ClientDir)">
                     <Component Id="cmf_afsshare_EXE" Guid="E972DA35-E950-4736-AE48-E6DDCE8C97D0">
                         <File Id="fileafsshare_EXE" Name="afsshare.exe" LongName="afsshare.exe" KeyPath="yes" DiskId="1" />
                     <Component Id="cmf_afsd_service_EXE" Guid="37A90054-505D-4C57-B489-7EF4D97B86F6">
                         <File Id="fileafsd_service_EXE" Name="afsd_svc.exe" LongName="afsd_service.exe" KeyPath="yes" DiskId="1" />
                         <ServiceControl Id="TransarcAFSDaemon" Name="TransarcAFSDaemon" Stop="both" Delete="both" Wait="yes" />
-                        <ServiceInstall Id="svc_Client" Name="TransarcAFSDaemon" DisplayName="OpenAFS Client" Type="ownProcess" Start="auto" ErrorControl="normal">
+                        <ServiceInstall Id="svc_Client" Name="TransarcAFSDaemon" DisplayName="OpenAFS Client" Type="ownProcess" Start="auto" ErrorControl="normal" Description="Provides access to files and directories stored in AFS">
                                                        <!-- ServiceConfig doesn't currently do what you think it does.
                                                             We instead use a custom action to set the service failure actions.
                             <ServiceConfig FirstFailureActionType="restart" RestartServiceDelayInSeconds="10" SecondFailureActionType="restart" ThirdFailureActionType="none"/>
                         <Environment Id="envClient" Name="PATH" Action="create" System="yes" Permanent="no" Part="last" Separator=";" Value="[AFSDIR]Client\Program" />
                         <RemoveFile Id="removeCache" Directory="WindowsVolume" LongName="AFSCache" Name="AFSCache" On="uninstall" />
                     </Component>
-                    <Component Id="cmf_afslogon_DLL" Guid="123197FE-4F53-4035-8D51-FCFB6B50A777">
-                        <File Id="fileafslogon_DLL" Name="afslogon.dll" LongName="afslogon.dll" KeyPath="yes" DiskId="1" />
-                    </Component>
                     <Component Id="cmf_symlink_EXE" Guid="01513839-36E5-418D-8337-04B5D74337CD">
                         <File Id="filesymlink_EXE" Name="symlink.exe" LongName="symlink.exe" KeyPath="yes" DiskId="1" />
                     </Component>
                         <File Id="fileafscreds_PDB" Name="afscreds.pdb" LongName="afscreds.pdb" DiskId="1" />
                         <File Id="fileafs_shl_ext_PDB" Name="afsshext.pdb" LongName="afs_shl_ext.pdb" DiskId="1" />
                         <File Id="fileafsd_service_PDB" Name="afsd_svc.pdb" LongName="afsd_service.pdb" DiskId="1" />
-                        <File Id="fileaklogon_PDB" Name="afslogon.pdb" LongName="afslogon.pdb" DiskId="1" />
                         <File Id="filesymlink_PDB" Name="symlink.pdb" LongName="symlink.pdb" DiskId="1" />
                         <File Id="filekpasswd_PDB" Name="kpasswd.pdb" LongName="kpasswd.pdb" DiskId="1" src="$(var.BinDir)kpasswd.pdb" />
                         <File Id="filepts_PDB" Name="pts.pdb" LongName="pts.pdb" DiskId="1" src="$(var.BinDir)pts.pdb" />
                             <Component Id="cmf_bosctlsvc_EXE" Guid="8F6F62A8-BB6D-46C1-BA80-4F207AA24F0D">
                                 <File Id="filebosctlsvc_EXE" Name="bosct.exe" LongName="bosctlsvc.exe" KeyPath="yes" DiskId="1" />
                                 <ServiceControl Id="TransarcAFSServer" Name="TransarcAFSServer" Stop="both" Delete="both" Wait="yes" />
-                                <ServiceInstall Id="svc_Server" Name="TransarcAFSServer" DisplayName="OpenAFS Server" Type="ownProcess" Start="auto" ErrorControl="normal">
+                                <ServiceInstall Id="svc_Server" Name="TransarcAFSServer" DisplayName="OpenAFS Server" Type="ownProcess" Start="auto" ErrorControl="normal" Description="Manages AFS server processes">
                                                                        <!-- ServiceConfig does nothing 
                                     <ServiceConfig FirstFailureActionType="restart" RestartServiceDelayInSeconds="5" SecondFailureActionType="restart" ThirdFailureActionType="none"/>
                                     -->
index 70a4697..41dfcff 100644 (file)
@@ -11,7 +11,6 @@
        <Property Id="RXMAXMTU">$(var.RxMaxMTU)</Property>
        <Property Id="HIDEDOTFILES">$(var.HideDotFiles)</Property>
        <Property Id="SECURITYLEVEL">$(var.SecurityLevel)</Property>
-
        <Property Id="CREDSSTARTUP">1</Property>
        <Property Id="CREDSAUTOINIT">-a</Property>
        <Property Id="CREDSRENEWDRMAP">-m</Property>
index 3f50ea5..110c5a0 100644 (file)
         <Registry Root="HKCR" Key="*\shellex\ContextMenuHandlers\AFS Client Shell Extension" Name="*" Id="reg_Client19" />
         <Registry Root="HKCR" Key="*\shellex\ContextMenuHandlers\AFS Client Shell Extension" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client20" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="*" Id="reg_Client21" />
-        <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="AuthentProviderPath" Type="expandable" Value="[AFSDIR]Client\PROGRAM\afslogon.dll" Id="reg_Client22" />
+        <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="AuthentProviderPath" Type="expandable" Value="[SystemFolder]afslogon.dll" Id="reg_Client22" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Id="reg_Client23" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="LogonOptions" Type="integer" Value="[LOGONOPTIONS]" Id="reg_Client24" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="VerboseLogging" Type="integer" Value="10" Id="reg_Client25" />
-        <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="ProviderPath" Type="expandable" Value="[AFSDIR]Client\PROGRAM\afslogon.dll" Id="reg_Client26" />
+        <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="ProviderPath" Type="expandable" Value="[SystemFolder]afslogon.dll" Id="reg_Client26" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="LogonScript" Type="expandable" Value="[AFSDIR]Client\Program\afscreds.exe -:%s -x -a -m -n -q" Id="reg_Client27" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="Class" Type="integer" Value="2" Id="reg_Client29" />
         <Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="Name" Value="TransarcAFSDaemon" Id="reg_Client30" />
index d8f2ec7..c22d120 100644 (file)
@@ -21,7 +21,9 @@ extern int nterr_nt2unix(long ntErr, int defaultErr);
 #define AFS_NT_ERRNO_BASE  100
 
 /* Overloaded codes. */
+#ifndef EWOULDBLOCK
 #define EWOULDBLOCK        EAGAIN
+#endif
 
 /* New codes */
 #define ELOOP              (AFS_NT_ERRNO_BASE + 1)