vfs catia: Fix a NULL dereference when CATIA is loaded with no mappings specified.
authorAravind Srinivasan <aravind.srinivasan@isilon.com>
Wed, 23 Sep 2009 20:37:04 +0000 (20:37 +0000)
committerTim Prouty <tprouty@samba.org>
Thu, 24 Sep 2009 17:59:33 +0000 (10:59 -0700)
When we use the CATIA vfs module and don't have any mapping specified,
we return NULL for the mapped_name, thereby resulting in segfaults.
When we don't have catia mapping, we should just use the old name
instead of returning NULL for the mapped_name.

Signed-off-by: Tim Prouty <tprouty@samba.org>
source3/modules/vfs_catia.c

index 2631060441093c2ba3dde7ac8d30a3e2989f807d..14e404f9f5c09678adfb2e768778fab61c7ebb16 100644 (file)
@@ -224,8 +224,15 @@ static NTSTATUS catia_string_replace_allocate(connection_struct *conn,
        size_t converted_size;
        TALLOC_CTX *ctx = talloc_tos();
 
-       if (!init_mappings(conn, &selected))
+       if (!init_mappings(conn, &selected)) {
+               /* No mappings found. Just use the old name */
+               *mapped_name = talloc_strdup(NULL, name_in);
+               if (!*mapped_name) {
+                       errno = ENOMEM;
+                       return NT_STATUS_NO_MEMORY;
+               }
                return NT_STATUS_OK;
+       }
 
        if ((push_ucs2_talloc(ctx, &tmpbuf, name_in,
                              &converted_size)) == -1) {