[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-2335-g2f88475

Günther Deschner gd at samba.org
Tue Jun 16 09:51:35 GMT 2009


The branch, master has been updated
       via  2f884753dd9fea349adfd826b14780129d5fdd06 (commit)
       via  c033039e622f711568fbbc316bef257b33888928 (commit)
      from  308de544f4dd1e23197d3b6d3be85cef1f5f9ded (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2f884753dd9fea349adfd826b14780129d5fdd06
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jun 16 11:49:36 2009 +0200

    s3-docs: fix typo in pam_winbind.8.
    
    Guenther

commit c033039e622f711568fbbc316bef257b33888928
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jun 15 17:25:08 2009 +0200

    s3-netapi: add NetGetJoinInformation example code.
    
    Guenther

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

Summary of changes:
 docs-xml/manpages-3/pam_winbind.8.xml              |    2 +-
 source3/lib/netapi/examples/Makefile.in            |    6 ++
 .../{getjoinableous.c => getjoininformation.c}     |   57 +++++++++++--------
 3 files changed, 40 insertions(+), 25 deletions(-)
 copy source3/lib/netapi/examples/join/{getjoinableous.c => getjoininformation.c} (60%)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/pam_winbind.8.xml b/docs-xml/manpages-3/pam_winbind.8.xml
index 730ad96..ae29c40 100644
--- a/docs-xml/manpages-3/pam_winbind.8.xml
+++ b/docs-xml/manpages-3/pam_winbind.8.xml
@@ -221,7 +221,7 @@
 		<term>PAM_WINBIND_PROFILEPATH</term>
 		<listitem>
 			<para>
-				This is the profile path set in the profile tab in the user settings. Noramlly
+				This is the profile path set in the profile tab in the user settings. Normally
 				the home directory is synced with this directory on a share.
 			</para>
 		</listitem>
diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in
index 5adedac..2a99f57 100644
--- a/source3/lib/netapi/examples/Makefile.in
+++ b/source3/lib/netapi/examples/Makefile.in
@@ -22,6 +22,7 @@ PROGS = bin/getdc at EXEEXT@ \
 	bin/netdomjoin at EXEEXT@ \
 	bin/netdomjoin-gui at EXEEXT@ \
 	bin/getjoinableous at EXEEXT@ \
+	bin/getjoininformation at EXEEXT@ \
 	bin/rename_machine at EXEEXT@ \
 	bin/user_add at EXEEXT@ \
 	bin/user_del at EXEEXT@ \
@@ -98,6 +99,7 @@ DSGETDC_OBJ = dsgetdc/dsgetdc.o $(CMDLINE_OBJ)
 NETDOMJOIN_OBJ = join/netdomjoin.o $(CMDLINE_OBJ)
 NETDOMJOIN_GUI_OBJ = netdomjoin-gui/netdomjoin-gui.o
 GETJOINABLEOUS_OBJ = join/getjoinableous.o $(CMDLINE_OBJ)
+GETJOININFORMATION_OBJ = join/getjoininformation.o $(CMDLINE_OBJ)
 RENAMEMACHINE_OBJ = join/rename_machine.o $(CMDLINE_OBJ)
 USERADD_OBJ = user/user_add.o $(CMDLINE_OBJ)
 USERDEL_OBJ = user/user_del.o $(CMDLINE_OBJ)
@@ -154,6 +156,10 @@ bin/getjoinableous at EXEEXT@: $(BINARY_PREREQS) $(GETJOINABLEOUS_OBJ)
 	@echo Linking $@
 	@$(CC) $(CCFLAGS) -o $@ $(GETJOINABLEOUS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
 
+bin/getjoininformation at EXEEXT@: $(BINARY_PREREQS) $(GETJOININFORMATION_OBJ)
+	@echo Linking $@
+	@$(CC) $(CCFLAGS) -o $@ $(GETJOININFORMATION_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+
 bin/rename_machine at EXEEXT@: $(BINARY_PREREQS) $(RENAMEMACHINE_OBJ)
 	@echo Linking $@
 	@$(CC) $(CCFLAGS) -o $@ $(RENAMEMACHINE_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
diff --git a/source3/lib/netapi/examples/join/getjoinableous.c b/source3/lib/netapi/examples/join/getjoininformation.c
similarity index 60%
copy from source3/lib/netapi/examples/join/getjoinableous.c
copy to source3/lib/netapi/examples/join/getjoininformation.c
index 732f73d..3db0f4a 100644
--- a/source3/lib/netapi/examples/join/getjoinableous.c
+++ b/source3/lib/netapi/examples/join/getjoininformation.c
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
  *  Join Support (cmdline + netapi)
- *  Copyright (C) Guenther Deschner 2008
+ *  Copyright (C) Guenther Deschner 2009
  *
  *  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
@@ -30,18 +30,15 @@ int main(int argc, const char **argv)
 {
 	NET_API_STATUS status;
 	const char *host_name = NULL;
-	const char *domain_name = NULL;
-	const char **ous = NULL;
-	uint32_t num_ous = 0;
+	const char *name_buffer = NULL;
+	uint16_t name_type = 0;
 	struct libnetapi_ctx *ctx = NULL;
-	int i;
 
 	poptContext pc;
 	int opt;
 
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
-		{ "domain", 0, POPT_ARG_STRING, NULL, 'D', "Domain name", "DOMAIN" },
 		POPT_COMMON_LIBNETAPI_EXAMPLES
 		POPT_TABLEEND
 	};
@@ -51,15 +48,10 @@ int main(int argc, const char **argv)
 		return status;
 	}
 
-	pc = poptGetContext("getjoinableous", argc, argv, long_options, 0);
+	pc = poptGetContext("getjoininformation", argc, argv, long_options, 0);
 
-	poptSetOtherOptionHelp(pc, "hostname domainname");
+	poptSetOtherOptionHelp(pc, "hostname");
 	while((opt = poptGetNextOpt(pc)) != -1) {
-		switch (opt) {
-			case 'D':
-				domain_name = poptGetOptArg(pc);
-				break;
-		}
 	}
 
 	if (!poptPeekArg(pc)) {
@@ -68,26 +60,43 @@ int main(int argc, const char **argv)
 	}
 	host_name = poptGetArg(pc);
 
-	/* NetGetJoinableOUs */
+	/* NetGetJoinInformation */
 
-	status = NetGetJoinableOUs(host_name,
-				   domain_name,
-				   ctx->username,
-				   ctx->password,
-				   &num_ous,
-				   &ous);
+	status = NetGetJoinInformation(host_name,
+				       &name_buffer,
+				       &name_type);
 	if (status != 0) {
 		printf("failed with: %s\n",
 			libnetapi_get_error_string(ctx, status));
 	} else {
-		printf("Successfully queried joinable ous:\n");
-		for (i=0; i<num_ous; i++) {
-			printf("ou: %s\n", ous[i]);
+		printf("Successfully queried join information:\n");
+
+		switch (name_type) {
+		case NetSetupUnknownStatus:
+			printf("%s's join status unknown (name: %s)\n",
+				host_name, name_buffer);
+			break;
+		case NetSetupUnjoined:
+			printf("%s is not joined (name: %s)\n",
+				host_name, name_buffer);
+			break;
+		case NetSetupWorkgroupName:
+			printf("%s is joined to workgroup %s\n",
+				host_name, name_buffer);
+			break;
+		case NetSetupDomainName:
+			printf("%s is joined to domain %s\n",
+				host_name, name_buffer);
+			break;
+		default:
+			printf("%s is in unknown status %d (name: %s)\n",
+				host_name, name_type, name_buffer);
+			break;
 		}
 	}
 
  out:
-	NetApiBufferFree(ous);
+	NetApiBufferFree((void *)name_buffer);
 	libnetapi_free(ctx);
 	poptFreeContext(pc);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list