Fix Bug #5548 (segfauls in handle_include with %m macro expansion).
authorMichael Adam <obnox@samba.org>
Wed, 18 Jun 2008 12:50:53 +0000 (14:50 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 18 Jun 2008 12:50:53 +0000 (14:50 +0200)
In alloc_sub_basic, when expanding '%m', substitute "" instead of
NULL for remote_machine when this is NULL. Else a NULL string
is returned.

Michael
(This used to be commit c65b456c6a145d15b7fd27a2a3440a0709fc3277)

source3/lib/substitute.c

index 17bcbcac9d8cf3fb613e1dace794975d01162711..926bb8233d7e24586b144f6bfe9b7bb821141d30 100644 (file)
@@ -655,7 +655,10 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name,
                        a_string = realloc_string_sub(a_string, "%h", myhostname());
                        break;
                case 'm' :
-                       a_string = realloc_string_sub(a_string, "%m", remote_machine);
+                       a_string = realloc_string_sub(a_string, "%m",
+                                                     remote_machine
+                                                     ? remote_machine
+                                                     : "");
                        break;
                case 'v' :
                        a_string = realloc_string_sub(a_string, "%v", SAMBA_VERSION_STRING);