s3:net registry check: do not silently replace separators
authorGregor Beck <gbeck@sernet.de>
Thu, 20 Oct 2011 15:36:10 +0000 (17:36 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 26 Oct 2011 00:44:03 +0000 (02:44 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/utils/net_registry_check.c

index 2511f53..0ae2c96 100644 (file)
@@ -709,13 +709,14 @@ static bool normalize_path_internal(char* path, char sep) {
 static bool normalize_path(char* path, char sep) {
        static const char* SEPS = "\\/";
        char* firstsep = strpbrk(path, SEPS);
+       bool wrong_sep = (firstsep && (*firstsep != sep));
 
        assert (strchr(SEPS, sep));
 
-       if (firstsep && (*firstsep != sep)) {
+       if (wrong_sep) {
                string_replace(path, *firstsep, sep);
        }
-       return normalize_path_internal(path, sep);
+       return normalize_path_internal(path, sep) || wrong_sep;
 }
 
 static int check_tdb_action(struct db_record *rec, void *check_ctx)