svn commit: samba r19789 - in branches/SAMBA_3_0_24/source: . rpcclient utils

jerry at samba.org jerry at samba.org
Sun Nov 19 17:32:46 GMT 2006


Author: jerry
Date: 2006-11-19 17:32:46 +0000 (Sun, 19 Nov 2006)
New Revision: 19789

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19789

Log:
making progress ... moving on to rpcclient now
Added:
   branches/SAMBA_3_0_24/source/utils/status_profile.c
Modified:
   branches/SAMBA_3_0_24/source/Makefile.in
   branches/SAMBA_3_0_24/source/rpcclient/cmd_samr.c
   branches/SAMBA_3_0_24/source/utils/net_idmap.c
   branches/SAMBA_3_0_24/source/utils/smbcontrol.c


Changeset:
Modified: branches/SAMBA_3_0_24/source/Makefile.in
===================================================================
--- branches/SAMBA_3_0_24/source/Makefile.in	2006-11-19 17:24:54 UTC (rev 19788)
+++ branches/SAMBA_3_0_24/source/Makefile.in	2006-11-19 17:32:46 UTC (rev 19789)
@@ -292,7 +292,8 @@
 LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
 	       rpc_client/cli_netlogon.o rpc_client/cli_reg.o $(RPC_CLIENT_OBJ) \
 	       rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o  \
-	       rpc_client/cli_ds.o rpc_client/cli_svcctl.o
+	       rpc_client/cli_ds.o rpc_client/cli_svcctl.o \
+	       rpc_client/cli_srvsvc.o rpc_client/cli_shutdown.o
 
 REGOBJS_OBJ = registry/reg_objects.o
 
@@ -348,7 +349,7 @@
                 rpc_parse/parse_ntsvcs.o rpc_parse/parse_svcctl.o $(REGOBJS_OBJ) \
 		rpc_parse/parse_srv.o rpc_parse/parse_dfs.o \
 		rpc_parse/parse_reg.o rpc_parse/parse_echo.o \
-		rpc_parse/parse_wks.o
+		rpc_parse/parse_wks.o rpc_parse/parse_shutdown.o
 
 RPC_CLIENT_OBJ = rpc_client/cli_pipe.o
 
@@ -505,7 +506,8 @@
 	     $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \
              rpc_client/cli_pipe.o rpc_parse/parse_rpc.o \
              rpc_client/cli_netlogon.o rpc_parse/parse_net.o \
-			$(LIBMSRPC_GEN_OBJ)
+	     rpc_client/cli_srvsvc.o rpc_parse/parse_srv.o \
+	     $(LIBMSRPC_GEN_OBJ)
 
 TESTPARM_OBJ = utils/testparm.o \
                $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
@@ -566,8 +568,8 @@
 	$(GROUPDB_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
 
 CLIENT_OBJ1 = client/client.o client/clitar.o rpc_client/cli_pipe.o \
-			  rpc_parse/parse_rpc.o rpc_client/cli_netlogon.o \
-			  rpc_parse/parse_net.o
+	      rpc_parse/parse_rpc.o rpc_client/cli_netlogon.o \
+	      rpc_parse/parse_net.o rpc_client/cli_srvsvc.o rpc_parse/parse_srv.o
 
 CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \
 	     $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \

Modified: branches/SAMBA_3_0_24/source/rpcclient/cmd_samr.c
===================================================================
--- branches/SAMBA_3_0_24/source/rpcclient/cmd_samr.c	2006-11-19 17:24:54 UTC (rev 19788)
+++ branches/SAMBA_3_0_24/source/rpcclient/cmd_samr.c	2006-11-19 17:32:46 UTC (rev 19789)
@@ -77,7 +77,7 @@
 	unistr2_to_ascii(temp, &usr->uni_workstations, sizeof(temp)-1);
 	printf("\tWorkstations:\t%s\n", temp);
 	
-	unistr2_to_ascii(temp, &usr->uni_unknown_str, sizeof(temp)-1);
+	unistr2_to_ascii(temp, &usr->uni_comment, sizeof(temp)-1);
 	printf("\tUnknown Str :\t%s\n", temp);
 	
 	unistr2_to_ascii(temp, &usr->uni_munged_dial, sizeof(temp)-1);
@@ -128,7 +128,6 @@
 
 	if (nttime.high==0x80000000 && nttime.low==0)
 		return "Never";
-
 	high = 65536;	
 	high = high/10000;
 	high = high*65536;

Modified: branches/SAMBA_3_0_24/source/utils/net_idmap.c
===================================================================
--- branches/SAMBA_3_0_24/source/utils/net_idmap.c	2006-11-19 17:24:54 UTC (rev 19788)
+++ branches/SAMBA_3_0_24/source/utils/net_idmap.c	2006-11-19 17:32:46 UTC (rev 19789)
@@ -185,6 +185,7 @@
 /***********************************************************
  Write entries from stdin to current local idmap
  **********************************************************/
+
 static int net_idmap_restore(int argc, const char **argv)
 {
 	if (!idmap_init(lp_idmap_backend())) {
@@ -193,10 +194,11 @@
 	}
 
 	while (!feof(stdin)) {
-		fstring line, sid_string, fmt_string;
+		fstring line, sid_string, fmt_string1, fmt_string2;
 		int len;
 		unid_t id;
-		int type = ID_EMPTY;
+		enum idmap_type type;
+		unsigned long idval;
 		DOM_SID sid;
 
 		if (fgets(line, sizeof(line)-1, stdin) == NULL)
@@ -207,20 +209,16 @@
 		if ( (len > 0) && (line[len-1] == '\n') )
 			line[len-1] = '\0';
 
-		/* Yuck - this is broken for sizeof(gid_t) != sizeof(int) */
-		snprintf(fmt_string, sizeof(fmt_string), "GID %%d %%%us", FSTRING_LEN);
-		if (sscanf(line, fmt_string, &id.gid, sid_string) == 2) {
-			type = ID_GROUPID;
-		}
+		snprintf(fmt_string1, sizeof(fmt_string1), "GID %%ul %%%us", FSTRING_LEN);
+		snprintf(fmt_string2, sizeof(fmt_string2), "UID %%ul %%%us", FSTRING_LEN);
 
-		/* Yuck - this is broken for sizeof(uid_t) != sizeof(int) */
-
-		snprintf(fmt_string, sizeof(fmt_string), "UID %%d %%%us", FSTRING_LEN);
-		if (sscanf(line, fmt_string, &id.uid, sid_string) == 2) {
+		if (sscanf(line, fmt_string1, &idval, sid_string) == 2) {
+			type = ID_GROUPID;
+			id.gid = (gid_t)idval;
+		} else if (sscanf(line, fmt_string2, &idval, sid_string) == 2) {
 			type = ID_USERID;
-		}
-
-		if (type == ID_EMPTY) {
+			id.uid = (uid_t)idval;
+		} else {
 			d_printf("ignoring invalid line [%s]\n", line);
 			continue;
 		}

Modified: branches/SAMBA_3_0_24/source/utils/smbcontrol.c
===================================================================
--- branches/SAMBA_3_0_24/source/utils/smbcontrol.c	2006-11-19 17:24:54 UTC (rev 19788)
+++ branches/SAMBA_3_0_24/source/utils/smbcontrol.c	2006-11-19 17:32:46 UTC (rev 19789)
@@ -882,25 +882,27 @@
 	   5 times. */
 
 	for (retry = 0; retry < 5; retry++) {
-		int err;
 		TDB_DATA d;
+		char buf[4];
+
 		ZERO_STRUCT(d);
+
+		SIVAL(buf, 0, time(NULL));
+		d.dptr = buf;
+		d.dsize = 4;
+
 		tdb_store_bystring(tdb, "WINBINDD_OFFLINE", d, TDB_INSERT);
 
 		ret = send_message(pid, MSG_WINBIND_OFFLINE, NULL, 0, False);
 
 		/* Check that the entry "WINBINDD_OFFLINE" still exists. */
-		tdb->ecode = TDB_SUCCESS;
 		d = tdb_fetch_bystring( tdb, "WINBINDD_OFFLINE" );
-
-		/* As this is a key with no data we don't need to free, we
-		   check for existence by looking at tdb_err. */
-
-		err = tdb_error(tdb);
-
-		if (err == TDB_ERR_NOEXIST) {
+	
+		if (!d.dptr || d.dsize != 4) {
+			SAFE_FREE(d.dptr);
 			DEBUG(10,("do_winbind_offline: offline state not set - retrying.\n"));
 		} else {
+			SAFE_FREE(d.dptr);
 			break;
 		}
 	}

Copied: branches/SAMBA_3_0_24/source/utils/status_profile.c (from rev 19780, branches/SAMBA_3_0/source/utils/status_profile.c)



More information about the samba-cvs mailing list