diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/netapi/serverinfo.c | 14 | ||||
-rw-r--r-- | source3/libnet/libnet_conf.c | 46 |
2 files changed, 53 insertions, 7 deletions
diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index d6031b69d2..d1bfa47649 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -163,12 +163,13 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_INVALID_PARAM; } - /* - return libnet_conf_set_parm(GLOBAL_NAME, - "server string", - info1005->comment); - */ - return WERR_NOT_SUPPORTED; + if (!lp_include_registry_globals()) { + return WERR_NOT_SUPPORTED; + } + + return libnet_smbconf_set_global_param(ctx, + "server string", + info1005->comment); } static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, @@ -180,7 +181,6 @@ static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, switch (level) { case 1005: return NetServerSetInfoLocal_1005(ctx, buffer, parm_error); - break; default: return WERR_UNKNOWN_LEVEL; } diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index f394e02e20..8bc5161268 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -147,3 +147,49 @@ done: return werr; } +static WERROR do_modify_val_config(struct registry_key *key, + const char *val_name, + const char *val_data) +{ + struct registry_value val; + + ZERO_STRUCT(val); + + val.type = REG_SZ; + val.v.sz.str = CONST_DISCARD(char *, val_data); + val.v.sz.len = strlen(val_data) + 1; + + return reg_setvalue(key, val_name, &val); +} + +WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, + const char *param, + const char *val) +{ + WERROR werr; + struct registry_key *key = NULL; + + if (!lp_include_registry_globals()) { + return WERR_NOT_SUPPORTED; + } + + if (!registry_init_regdb()) { + return WERR_REG_IO_FAILURE; + } + + if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { + werr = libnet_reg_createkey_internal(mem_ctx, + GLOBAL_NAME, &key); + } else { + werr = libnet_smbconf_open_path(mem_ctx, + GLOBAL_NAME, + REG_KEY_WRITE, &key); + } + + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + return do_modify_val_config(key, param, val); +} + |