Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-trivial
[jelmer/samba4-debian.git] / source / param / util.c
index 8d59861f400bbfb0713f8a9ea214a78e41f83472..1cf05d4fa7a5ca77ea88478aa21d0a8533f8d27a 100644 (file)
@@ -106,8 +106,11 @@ _PUBLIC_ char *config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
 {
        char *fname, *config_dir, *p;
        config_dir = talloc_strdup(mem_ctx, lp_configfile(lp_ctx));
+       if (config_dir == NULL) {
+               return NULL;
+       }
        p = strrchr(config_dir, '/');
-       if (!p) {
+       if (p == NULL) {
                return NULL;
        }
        p[0] = '\0';
@@ -283,3 +286,12 @@ _PUBLIC_ const char *lp_messaging_path(TALLOC_CTX *mem_ctx,
        return smbd_tmp_path(mem_ctx, lp_ctx, "messaging");
 }
 
+struct smb_iconv_convenience *smb_iconv_convenience_init_lp(TALLOC_CTX *mem_ctx,
+                                                        struct loadparm_context *lp_ctx)
+{
+       return smb_iconv_convenience_init(mem_ctx, lp_dos_charset(lp_ctx),
+                                         lp_unix_charset(lp_ctx),
+               lp_parm_bool(lp_ctx, NULL, "iconv", "native", true));
+}
+
+