Windows: CM_ERROR_INEXACT_MATCH is not a fatal error
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 12 Oct 2015 13:56:07 +0000 (09:56 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Mon, 19 Oct 2015 20:05:35 +0000 (16:05 -0400)
cm_BPlusDirLookup() and cm_Lookup() can return CM_ERROR_INEXACT_MATCH
which is not a fatal error.  Instead it is an indication that the returned
cm_scache object was not a case sensitive match.  Do not fail the request
and do not leak the cm_scache reference.

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

src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsrdr/user/RDRFunction.c

index bc42626..c6230a4 100644 (file)
@@ -1089,7 +1089,7 @@ cm_IoctlStatMountPoint(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scache
     cp = cm_ParseIoctlStringAlloc(ioctlp, NULL);
 
     code = cm_Lookup(dscp, cp[0] ? cp : L".", CM_FLAG_NOMOUNTCHASE, userp, reqp, &scp);
-    if (code)
+    if (code && code != CM_ERROR_INEXACT_MATCH)
         goto done_2;
 
     lock_ObtainWrite(&scp->rw);
@@ -1146,7 +1146,7 @@ cm_IoctlDeleteMountPoint(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scac
     code = cm_Lookup(dscp, cp[0] ? cp : L".", CM_FLAG_NOMOUNTCHASE, userp, reqp, &scp);
 
     /* if something went wrong, bail out now */
-    if (code)
+    if (code && code != CM_ERROR_INEXACT_MATCH)
         goto done3;
 
     lock_ObtainWrite(&scp->rw);
@@ -2245,7 +2245,7 @@ cm_IoctlListlink(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scache_t *ds
     clientp = cm_Utf8ToClientStringAlloc(cp, -1, NULL);
     code = cm_Lookup(dscp, clientp[0] ? clientp : L".", CM_FLAG_NOMOUNTCHASE, userp, reqp, &scp);
     free(clientp);
-    if (code)
+    if (code && code != CM_ERROR_INEXACT_MATCH)
         return code;
 
     /* Check that it's a real symlink */
@@ -2314,7 +2314,7 @@ cm_IoctlIslink(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scache_t *dscp
     clientp = cm_Utf8ToClientStringAlloc(cp, -1, NULL);
     code = cm_Lookup(dscp, clientp[0] ? clientp : L".", CM_FLAG_NOMOUNTCHASE, userp, reqp, &scp);
     free(clientp);
-    if (code)
+    if (code && code != CM_ERROR_INEXACT_MATCH)
         return code;
 
     /* Check that it's a real symlink */
@@ -2352,7 +2352,7 @@ cm_IoctlDeletelink(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scache_t *
     code = cm_Lookup(dscp, clientp[0] ? clientp : L".", CM_FLAG_NOMOUNTCHASE, userp, reqp, &scp);
 
     /* if something went wrong, bail out now */
-    if (code)
+    if (code && code != CM_ERROR_INEXACT_MATCH)
         goto done3;
 
     lock_ObtainWrite(&scp->rw);
index eb4ab62..940deda 100644 (file)
@@ -2309,7 +2309,7 @@ RDR_DeleteFileEntry( IN cm_user_t *userp,
     }
 
     code = cm_Lookup(dscp, FileName, 0, userp, &req, &scp);
-    if (code) {
+    if (code && code != CM_ERROR_INEXACT_MATCH) {
         smb_MapNTError(cm_MapRPCError(code, &req), &status, TRUE);
         (*ResultCB)->ResultStatus = status;
         (*ResultCB)->ResultBufferLength = 0;
@@ -2597,7 +2597,7 @@ RDR_RenameFileEntry( IN cm_user_t *userp,
             cm_EndDirOp(&dirop);
         }
 
-        if (code != 0) {
+       if (code != 0 && code != CM_ERROR_INEXACT_MATCH) {
             osi_Log1(afsd_logp, "RDR_RenameFileEntry cm_BPlusDirLookup failed code 0x%x",
                      code);
             (*ResultCB)->ResultStatus = STATUS_OBJECT_PATH_INVALID;
@@ -2923,7 +2923,7 @@ RDR_HardLinkFileEntry( IN cm_user_t *userp,
             cm_EndDirOp(&dirop);
         }
 
-        if (code != 0) {
+       if (code != 0 && code != CM_ERROR_INEXACT_MATCH) {
             osi_Log1(afsd_logp, "RDR_HardLinkFileEntry cm_BPlusDirLookup failed code 0x%x",
                      code);
             (*ResultCB)->ResultStatus = STATUS_OBJECT_PATH_INVALID;