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)
committerKarolin Seeger <kseeger@samba.org>
Wed, 18 Jun 2008 20:40:40 +0000 (22:40 +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
(cherry picked from commit c65b456c6a145d15b7fd27a2a3440a0709fc3277)
(cherry picked from commit ffaed197d8cb261e2765b2de6cad17cac7d49672)

source/lib/substitute.c

index 62dfdb56b56c3d4829decd223c493081ec3a68db..6c74f54649f70360608694f03df4f484d713a7fe 100644 (file)
@@ -648,7 +648,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);