mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Remove all d_fprintf-s from libnet_conf.c
Replacing them buy DEBUG statements and filling in d_fprintfs in callers in net_conf.c. Michael
This commit is contained in:
parent
5b4b335ed0
commit
1f0122d8d4
@ -167,12 +167,12 @@ WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx,
|
|||||||
werr = reg_createkey(ctx, create_parent, subkeyname,
|
werr = reg_createkey(ctx, create_parent, subkeyname,
|
||||||
REG_KEY_WRITE, newkey, &action);
|
REG_KEY_WRITE, newkey, &action);
|
||||||
if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
|
if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
|
||||||
d_fprintf(stderr, "Key '%s' already exists.\n", subkeyname);
|
DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
|
||||||
werr = WERR_ALREADY_EXISTS;
|
werr = WERR_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
if (!W_ERROR_IS_OK(werr)) {
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
d_fprintf(stderr, "Error creating key %s: %s\n",
|
DEBUG(5, ("Error creating key %s: %s\n",
|
||||||
subkeyname, dos_errstr(werr));
|
subkeyname, dos_errstr(werr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -198,11 +198,11 @@ WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key,
|
|||||||
&canon_valstr))
|
&canon_valstr))
|
||||||
{
|
{
|
||||||
if (canon_valname == NULL) {
|
if (canon_valname == NULL) {
|
||||||
d_fprintf(stderr, "invalid parameter '%s' given\n",
|
DEBUG(5, ("invalid parameter '%s' given\n",
|
||||||
valname);
|
valname));
|
||||||
} else {
|
} else {
|
||||||
d_fprintf(stderr, "invalid value '%s' given for "
|
DEBUG(5, ("invalid value '%s' given for "
|
||||||
"parameter '%s'\n", valstr, valname);
|
"parameter '%s'\n", valstr, valname));
|
||||||
}
|
}
|
||||||
werr = WERR_INVALID_PARAM;
|
werr = WERR_INVALID_PARAM;
|
||||||
goto done;
|
goto done;
|
||||||
@ -215,16 +215,16 @@ WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key,
|
|||||||
val.v.sz.len = strlen(canon_valstr) + 1;
|
val.v.sz.len = strlen(canon_valstr) + 1;
|
||||||
|
|
||||||
if (registry_smbconf_valname_forbidden(canon_valname)) {
|
if (registry_smbconf_valname_forbidden(canon_valname)) {
|
||||||
d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n",
|
DEBUG(5, ("Parameter '%s' not allowed in registry.\n",
|
||||||
canon_valname);
|
canon_valname));
|
||||||
werr = WERR_INVALID_PARAM;
|
werr = WERR_INVALID_PARAM;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
subkeyname = strrchr_m(key->key->name, '\\');
|
subkeyname = strrchr_m(key->key->name, '\\');
|
||||||
if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
|
if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
|
||||||
d_fprintf(stderr, "Invalid registry key '%s' given as "
|
DEBUG(5, ("Invalid registry key '%s' given as "
|
||||||
"smbconf section.\n", key->key->name);
|
"smbconf section.\n", key->key->name));
|
||||||
werr = WERR_INVALID_PARAM;
|
werr = WERR_INVALID_PARAM;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -232,19 +232,18 @@ WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key,
|
|||||||
if (!strequal(subkeyname, GLOBAL_NAME) &&
|
if (!strequal(subkeyname, GLOBAL_NAME) &&
|
||||||
lp_parameter_is_global(valname))
|
lp_parameter_is_global(valname))
|
||||||
{
|
{
|
||||||
d_fprintf(stderr, "Global paramter '%s' not allowed in "
|
DEBUG(5, ("Global paramter '%s' not allowed in "
|
||||||
"service definition ('%s').\n", canon_valname,
|
"service definition ('%s').\n", canon_valname,
|
||||||
subkeyname);
|
subkeyname));
|
||||||
werr = WERR_INVALID_PARAM;
|
werr = WERR_INVALID_PARAM;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
werr = reg_setvalue(key, canon_valname, &val);
|
werr = reg_setvalue(key, canon_valname, &val);
|
||||||
if (!W_ERROR_IS_OK(werr)) {
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
d_fprintf(stderr,
|
DEBUG(5, ("Error adding value '%s' to "
|
||||||
"Error adding value '%s' to "
|
|
||||||
"key '%s': %s\n",
|
"key '%s': %s\n",
|
||||||
canon_valname, key->key->name, dos_errstr(werr));
|
canon_valname, key->key->name, dos_errstr(werr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -216,6 +216,8 @@ static int import_process_service(TALLOC_CTX *ctx,
|
|||||||
}
|
}
|
||||||
werr = libnet_smbconf_reg_createkey_internal(tmp_ctx, servicename, &key);
|
werr = libnet_smbconf_reg_createkey_internal(tmp_ctx, servicename, &key);
|
||||||
if (!W_ERROR_IS_OK(werr)) {
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr, "Error creating share %s: %s\n",
|
||||||
|
servicename, dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,6 +237,10 @@ static int import_process_service(TALLOC_CTX *ctx,
|
|||||||
werr = libnet_smbconf_reg_setvalue_internal(key,
|
werr = libnet_smbconf_reg_setvalue_internal(key,
|
||||||
parm->label, valstr);
|
parm->label, valstr);
|
||||||
if (!W_ERROR_IS_OK(werr)) {
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr,
|
||||||
|
"Error setting parameter '%s'"
|
||||||
|
": %s\n", parm->label,
|
||||||
|
dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,31 +628,45 @@ static int net_conf_addshare(int argc, const char **argv)
|
|||||||
|
|
||||||
werr = libnet_smbconf_reg_createkey_internal(NULL, argv[0], &newkey);
|
werr = libnet_smbconf_reg_createkey_internal(NULL, argv[0], &newkey);
|
||||||
if (!W_ERROR_IS_OK(werr)) {
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr, "Error creating share %s: %s\n",
|
||||||
|
argv[0], dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add config params as values */
|
/* add config params as values */
|
||||||
|
|
||||||
werr = libnet_smbconf_reg_setvalue_internal(newkey, "path", path);
|
werr = libnet_smbconf_reg_setvalue_internal(newkey, "path", path);
|
||||||
if (!W_ERROR_IS_OK(werr))
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr, "Error setting parameter %s: %s\n",
|
||||||
|
"path", dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
if (comment != NULL) {
|
if (comment != NULL) {
|
||||||
werr = libnet_smbconf_reg_setvalue_internal(newkey, "comment",
|
werr = libnet_smbconf_reg_setvalue_internal(newkey, "comment",
|
||||||
comment);
|
comment);
|
||||||
if (!W_ERROR_IS_OK(werr))
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr, "Error setting parameter %s: %s\n",
|
||||||
|
"comment", dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
werr = libnet_smbconf_reg_setvalue_internal(newkey, "guest ok",
|
werr = libnet_smbconf_reg_setvalue_internal(newkey, "guest ok",
|
||||||
guest_ok);
|
guest_ok);
|
||||||
if (!W_ERROR_IS_OK(werr))
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr, "Error setting parameter %s: %s\n",
|
||||||
|
"'guest ok'", dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
werr = libnet_smbconf_reg_setvalue_internal(newkey, "writeable",
|
werr = libnet_smbconf_reg_setvalue_internal(newkey, "writeable",
|
||||||
writeable);
|
writeable);
|
||||||
if (!W_ERROR_IS_OK(werr))
|
if (!W_ERROR_IS_OK(werr)) {
|
||||||
|
d_fprintf(stderr, "Error setting parameter %s: %s\n",
|
||||||
|
"writeable", dos_errstr(werr));
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user