This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "lib/registry/registry.h"
#include "lib/cmdline/popt_common.h"
#include "lib/events/events.h"
-#include "lib/registry/reg_backend_rpc.h"
#include "system/time.h"
-#include "lib/replace/readline.h"
+#include "lib/smbreadline/smbreadline.h"
#include "librpc/gen_ndr/ndr_security.h"
/*
static struct registry_key *cmd_set(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv)
{
+ struct registry_value val;
+ WERROR error;
+
if (argc < 4) {
fprintf(stderr, "Usage: set value-name type value\n");
- } else {
- struct registry_value val;
- if (reg_string_to_val(mem_ctx, argv[2], argv[3], &val.data_type, &val.data)) {
- WERROR error = reg_val_set(cur, argv[1], val.data_type, val.data);
- if (!W_ERROR_IS_OK(error)) {
- fprintf(stderr, "Error setting value: %s\n", win_errstr(error));
- return NULL;
- }
- } else {
- fprintf(stderr, "Unable to interpret data\n");
- }
+ return cur;
+ }
+
+ if (!reg_string_to_val(mem_ctx, argv[2], argv[3], &val.data_type, &val.data)) {
+ fprintf(stderr, "Unable to interpret data\n");
+ return cur;
+ }
+
+ error = reg_val_set(cur, argv[1], val.data_type, val.data);
+ if (!W_ERROR_IS_OK(error)) {
+ fprintf(stderr, "Error setting value: %s\n", win_errstr(error));
+ return NULL;
}
return cur;
}
POPT_COMMON_SAMBA
POPT_COMMON_CREDENTIALS
POPT_COMMON_VERSION
- POPT_TABLEEND
+ { NULL }
};
- registry_init();
-
pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);
while((opt = poptGetNextOpt(pc)) != -1) {
}
+ registry_init();
+
if (remote) {
error = reg_open_remote (&h, NULL, cmdline_credentials, remote, NULL);
} else if (backend) {
error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, cmdline_credentials, &curkey);
} else {
- error = reg_open_local(&h, NULL, cmdline_credentials);
+ error = reg_open_local(NULL, &h, NULL, cmdline_credentials);
}
if(!W_ERROR_IS_OK(error)) {