diff options
Diffstat (limited to 'source3/utils/net.c')
| -rw-r--r-- | source3/utils/net.c | 144 | 
1 files changed, 0 insertions, 144 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 0f43c4aad3..da83886364 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -348,150 +348,6 @@ static int net_file(int argc, const char **argv)  	return net_rap_file(argc, argv);  } -/*********************************************************** - migrated functionality from smbgroupedit - **********************************************************/ -static int net_groupmap(int argc, const char **argv) -{ -	if ( 0 == argc ) -		return net_help_groupmap( argc, argv ); - -	if ( !StrCaseCmp( argv[0], "add" ) ) -		return net_groupmap_add(argc-1, argv+1); -	else if ( !StrCaseCmp( argv[0], "modify" ) ) -		return net_groupmap_modify(argc-1, argv+1); -	else if ( !StrCaseCmp( argv[0], "delete" ) ) -		return net_groupmap_delete(argc-1, argv+1); -	else if ( !StrCaseCmp( argv[0], "list" ) ) -		return net_groupmap_list(argc-1, argv+1); -	 -	return net_help_groupmap( argc, argv ); -} - -/*********************************************************** - Helper function for net_idmap_dump. Dump one entry. - **********************************************************/ -static int net_idmap_dump_one_entry(TDB_CONTEXT *tdb, -				    TDB_DATA key, -				    TDB_DATA data, -				    void *unused) -{ -	if (strcmp(key.dptr, "USER HWM") == 0) { -		printf("USER HWM %d\n", IVAL(data.dptr,0)); -		return 0; -	} - -	if (strcmp(key.dptr, "GROUP HWM") == 0) { -		printf("GROUP HWM %d\n", IVAL(data.dptr,0)); -		return 0; -	} - -	if (strncmp(key.dptr, "S-", 2) != 0) -		return 0; - -	printf("%s %s\n", data.dptr, key.dptr); -	return 0; -} - -/*********************************************************** - Dump the current idmap - **********************************************************/ -static int net_idmap_dump(int argc, const char **argv) -{ -	TDB_CONTEXT *idmap_tdb; - -	if ( argc != 1 ) -		return net_help_idmap( argc, argv ); - -	idmap_tdb = tdb_open_log(argv[0], 0, TDB_DEFAULT, O_RDONLY, 0); - -	if (idmap_tdb == NULL) { -		d_printf("Could not open idmap: %s\n", argv[0]); -		return -1; -	} - -	tdb_traverse(idmap_tdb, net_idmap_dump_one_entry, NULL); - -	tdb_close(idmap_tdb); - -	return 0; -} - -/*********************************************************** - Write entries from stdin to current local idmap - **********************************************************/ -static int net_idmap_restore(int argc, const char **argv) -{ -	if (!idmap_init()) { -		d_printf("Could not init idmap\n"); -		return -1; -	} - -	while (!feof(stdin)) { -		fstring line, sid_string; -		int len; -		unid_t id; -		int type = ID_EMPTY; -		DOM_SID sid; - -		if (fgets(line, sizeof(line)-1, stdin) == NULL) -			break; - -		len = strlen(line); - -		if ( (len > 0) && (line[len-1] == '\n') ) -			line[len-1] = '\0'; - -		if (sscanf(line, "GID %d %s", &id.gid, sid_string) == 2) { -			type = ID_GROUPID; -		} - -		if (sscanf(line, "UID %d %s", &id.uid, sid_string) == 2) { -			type = ID_USERID; -		} - -		if (type == ID_EMPTY) { -			d_printf("ignoring invalid line [%s]\n", line); -			continue; -		} - -		if (!string_to_sid(&sid, sid_string)) { -			d_printf("ignoring invalid sid [%s]\n", sid_string); -			continue; -		} - -		if (!NT_STATUS_IS_OK(idmap_set_mapping(&sid, id, type))) { -			d_printf("Could not set mapping of %s %d to sid %s\n", -				 (type == ID_GROUPID) ? "GID" : "UID", -				 (type == ID_GROUPID) ? id.gid : id.uid, -				 sid_string_static(&sid)); -			continue; -		} -				  -	} - -	idmap_close(); -	return 0; -} - -/*********************************************************** - Look at the current idmap - **********************************************************/ -static int net_idmap(int argc, const char **argv) -{ -	if ( 0 == argc ) -		return net_help_idmap( argc, argv ); - -	if ( !StrCaseCmp( argv[0], "dump" ) ) -		return net_idmap_dump(argc-1, argv+1); - -	if ( !StrCaseCmp( argv[0], "restore" ) ) -		return net_idmap_restore(argc-1, argv+1); - -	return net_help_idmap( argc, argv ); -} - -  /*   Retrieve our local SID or the SID for the specified name   */  | 
