Windows: netbios name comparisons are case insensitive
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 16 Mar 2013 05:15:01 +0000 (01:15 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 16 Mar 2013 22:09:54 +0000 (15:09 -0700)
When parsing the symlink target string to categorize it as AFS Symlink
or DFS Link, the comparison with the netbios name string must be case
insensitive.  Otherwise, symlinks are reported to the redirector as
DFS Links.  For the most part they will work since the AFS redirector
requesting MUP to Reparse the \\AFS path will call back into the AFS
redirector.  However, the attributes on symlinks to files will be wrong
as DFS Links can only be links to directories.

Change-Id: Ia9652991549b0783f7a534b071ff99ceabdd3382
Reviewed-on: http://gerrit.openafs.org/9612
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/user/RDRFunction.c

index 7d86f5c..d565eef 100644 (file)
@@ -676,7 +676,7 @@ RDR_PopulateCurrentEntry( IN  AFSDirEnumEntry * pCurrentEntry,
                         } else if (mp[offset] == '\\') {
                             size_t nbNameLen = strlen(cm_NetbiosName);
 
-                            if ( strncmp(&mp[offset + 1], cm_NetbiosName, nbNameLen) == 0 &&
+                            if ( strnicmp(&mp[offset + 1], cm_NetbiosName, nbNameLen) == 0 &&
                                  mp[offset + nbNameLen + 1] == '\\')
                             {
                                 /* an AFS symlink */
@@ -691,7 +691,7 @@ RDR_PopulateCurrentEntry( IN  AFSDirEnumEntry * pCurrentEntry,
                                 mbstowcs(wtarget, &mp[offset], wtarget_len);
 #endif
                             } else if ( mp[offset + 1] == '\\' &&
-                                        strncmp(&mp[offset + 2], cm_NetbiosName, strlen(cm_NetbiosName)) == 0 &&
+                                        strnicmp(&mp[offset + 2], cm_NetbiosName, strlen(cm_NetbiosName)) == 0 &&
                                         mp[offset + nbNameLen + 2] == '\\')
                             {
                                 /* an AFS symlink */