r12964: Rewind rem_backend in the case we have to workaround the idmap_ prefix.
authorLars Müller <lmuelle@samba.org>
Mon, 16 Jan 2006 17:21:47 +0000 (17:21 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:06:09 +0000 (11:06 -0500)
Else SAFE_FREE seg faults.  Thanks to Günther for pointing me at this.

I've implemented in in this was as we should announce to remove the
idmap_ strip stuff after some time at all.

source/sam/idmap.c

index 900f25f9c11db180643278479ae8b0bfaad7c764..9fc1a573a92422dce3566d74eee3d86ae6b1e2ca 100644 (file)
@@ -120,6 +120,7 @@ BOOL idmap_init(const char **remote_backend)
                char *rem_backend = smb_xstrdup(*remote_backend);
                fstring params = "";
                char *pparams;
+               BOOL idmap_prefix_workaround = False;
                
                /* get any mode parameters passed in */
                
@@ -132,6 +133,7 @@ BOOL idmap_init(const char **remote_backend)
                /* strip any leading idmap_ prefix of */
                if ( strncmp( rem_backend, "idmap_", 6) == 0 ) {
                        rem_backend += 6;
+                       idmap_prefix_workaround = True;
                        DEBUG(0, ("idmap_init: idmap backend uses deprecated 'idmap_' prefix.  Please replace 'idmap_%s' by '%s' in %s\n", rem_backend, rem_backend, dyn_CONFIGFILE));
                }
                
@@ -146,9 +148,13 @@ BOOL idmap_init(const char **remote_backend)
                        }
                } else {
                        DEBUG(0, ("idmap_init: could not load remote backend '%s'\n", rem_backend));
+                       if (idmap_prefix_workaround)
+                               rem_backend -= 6;
                        SAFE_FREE(rem_backend);
                        return False;
                }
+               if (idmap_prefix_workaround)
+                       rem_backend -= 6;
                SAFE_FREE(rem_backend);
        }