예제 #1
0
static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx,
				      struct NetServerSetInfo *r)
{
	WERROR werr = WERR_OK;
	sbcErr err;
	struct smbconf_ctx *conf_ctx;
	struct srvsvc_NetSrvInfo1005 *info1005;

	if (!r->in.buffer) {
		*r->out.parm_error = 1005; /* sure here ? */
		return WERR_INVALID_PARAM;
	}

	info1005 = (struct srvsvc_NetSrvInfo1005 *)r->in.buffer;

	if (!info1005->comment) {
		*r->out.parm_error = 1005;
		return WERR_INVALID_PARAM;
	}

#ifdef REGISTRY_BACKEND
	if (!lp_config_backend_is_registry())
#endif
	{
		libnetapi_set_error_string(ctx,
			"Configuration manipulation requested but not "
			"supported by backend");
		return WERR_NOT_SUPPORTED;
	}

	err = smbconf_init_reg(ctx, &conf_ctx, NULL);
	if (!SBC_ERROR_IS_OK(err)) {
		libnetapi_set_error_string(ctx,
			"Could not initialize backend: %s",
			sbcErrorString(err));
		werr = WERR_NO_SUCH_SERVICE;
		goto done;
	}

	err = smbconf_set_global_parameter(conf_ctx, "server string",
					    info1005->comment);
	if (!SBC_ERROR_IS_OK(err)) {
		libnetapi_set_error_string(ctx,
			"Could not set global parameter: %s",
			sbcErrorString(err));
		werr = WERR_NO_SUCH_SERVICE;
		goto done;
	}

 done:
	smbconf_shutdown(conf_ctx);
	return werr;
}
예제 #2
0
파일: serverinfo.c 프로젝트: AllardJ/Tomato
static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx,
				      struct NetServerSetInfo *r)
{
	WERROR werr;
	struct smbconf_ctx *conf_ctx;
	struct srvsvc_NetSrvInfo1005 *info1005;

	if (!r->in.buffer) {
		*r->out.parm_error = 1005; /* sure here ? */
		return WERR_INVALID_PARAM;
	}

	info1005 = (struct srvsvc_NetSrvInfo1005 *)r->in.buffer;

	if (!info1005->comment) {
		*r->out.parm_error = 1005;
		return WERR_INVALID_PARAM;
	}

	if (!lp_config_backend_is_registry()) {
		libnetapi_set_error_string(ctx,
			"Configuration manipulation requested but not "
			"supported by backend");
		return WERR_NOT_SUPPORTED;
	}

	werr = smbconf_init_reg(ctx, &conf_ctx, NULL);
	if (!W_ERROR_IS_OK(werr)) {
		goto done;
	}

	werr = smbconf_set_global_parameter(conf_ctx, "server string",
					    info1005->comment);

 done:
	smbconf_shutdown(conf_ctx);
	return werr;
}