[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-722-g3123e68

Günther Deschner gd at samba.org
Wed Apr 9 11:40:41 GMT 2008


The branch, v3-2-test has been updated
       via  3123e68bda70ad1cff9bd8f9375fd7935bf755dd (commit)
      from  92ba18fcd0816fb85846c6e788ea4a04c71e02a8 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 3123e68bda70ad1cff9bd8f9375fd7935bf755dd
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 9 13:38:39 2008 +0200

    Add Add NetUserDel example.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/lib/netapi/examples/Makefile.in             |    8 +++++-
 .../examples/{getdc/getdc.c => user/user_del.c}    |   24 ++++++++-----------
 2 files changed, 17 insertions(+), 15 deletions(-)
 copy source/lib/netapi/examples/{getdc/getdc.c => user/user_del.c} (76%)


Changeset truncated at 500 lines:

diff --git a/source/lib/netapi/examples/Makefile.in b/source/lib/netapi/examples/Makefile.in
index 0e074b6..c00c505 100644
--- a/source/lib/netapi/examples/Makefile.in
+++ b/source/lib/netapi/examples/Makefile.in
@@ -22,7 +22,8 @@ PROGS = bin/getdc at EXEEXT@ \
 	bin/netdomjoin at EXEEXT@ \
 	bin/netdomjoin-gui at EXEEXT@ \
 	bin/getjoinableous at EXEEXT@ \
-	bin/user_add at EXEEXT@
+	bin/user_add at EXEEXT@ \
+	bin/user_del at EXEEXT@
 
 all: $(PROGS)
 
@@ -57,6 +58,7 @@ NETDOMJOIN_OBJ = netdomjoin/netdomjoin.o $(CMDLINE_OBJ)
 NETDOMJOIN_GUI_OBJ = netdomjoin-gui/netdomjoin-gui.o
 GETJOINABLEOUS_OBJ = getjoinableous/getjoinableous.o $(CMDLINE_OBJ)
 USERADD_OBJ = user/user_add.o $(CMDLINE_OBJ)
+USERDEL_OBJ = user/user_del.o $(CMDLINE_OBJ)
 
 bin/getdc at EXEEXT@: $(BINARY_PREREQS) $(GETDC_OBJ)
 	@echo Linking $@
@@ -82,6 +84,10 @@ bin/user_add at EXEEXT@: $(BINARY_PREREQS) $(USERADD_OBJ)
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(USERADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
 
+bin/user_del at EXEEXT@: $(BINARY_PREREQS) $(USERDEL_OBJ)
+	@echo Linking $@
+	@$(CC) $(FLAGS) -o $@ $(USERDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+
 clean:
 	-rm -f $(PROGS)
 	-rm -f core */*~ *~ \
diff --git a/source/lib/netapi/examples/getdc/getdc.c b/source/lib/netapi/examples/user/user_del.c
similarity index 76%
copy from source/lib/netapi/examples/getdc/getdc.c
copy to source/lib/netapi/examples/user/user_del.c
index 98bb6a1..9cf28a9 100644
--- a/source/lib/netapi/examples/getdc/getdc.c
+++ b/source/lib/netapi/examples/user/user_del.c
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  GetDCName query
- *  Copyright (C) Guenther Deschner 2007
+ *  NetUserDel query
+ *  Copyright (C) Guenther Deschner 2008
  *
  *  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
@@ -31,10 +31,8 @@ int main(int argc, const char **argv)
 {
 	NET_API_STATUS status;
 	struct libnetapi_ctx *ctx = NULL;
-
 	const char *hostname = NULL;
-	const char *domain = NULL;
-	uint8_t *buffer = NULL;
+	const char *username = NULL;
 
 	poptContext pc;
 	int opt;
@@ -50,9 +48,9 @@ int main(int argc, const char **argv)
 		return status;
 	}
 
-	pc = poptGetContext("getdc", argc, argv, long_options, 0);
+	pc = poptGetContext("user_del", argc, argv, long_options, 0);
 
-	poptSetOtherOptionHelp(pc, "hostname domainname");
+	poptSetOtherOptionHelp(pc, "hostname username");
 	while((opt = poptGetNextOpt(pc)) != -1) {
 	}
 
@@ -66,19 +64,17 @@ int main(int argc, const char **argv)
 		poptPrintHelp(pc, stderr, 0);
 		goto out;
 	}
-	domain = poptGetArg(pc);
+	username = poptGetArg(pc);
 
-	/* NetGetDCName */
+	/* NetUserDel */
 
-	status = NetGetDCName(hostname, domain, &buffer);
+	status = NetUserDel(hostname, username);
 	if (status != 0) {
-		printf("GetDcName failed with: %s\n", libnetapi_errstr(status));
-	} else {
-		printf("%s\n", (char *)buffer);
+		printf("NetUserDel failed with: %s\n",
+			libnetapi_get_error_string(ctx, status));
 	}
 
  out:
-	NetApiBufferFree(buffer);
 	libnetapi_free(ctx);
 	poptFreeContext(pc);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list