svn commit: samba r12349 - in trunk/source: . rpc_client utils

jra at samba.org jra at samba.org
Mon Dec 19 04:19:05 GMT 2005


Author: jra
Date: 2005-12-19 04:19:04 +0000 (Mon, 19 Dec 2005)
New Revision: 12349

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

Log:
Move cli_netlookup.c -> utils/netlookup.c for the time
being until we have the correct popt code linked in.
Jeremy.

Added:
   trunk/source/utils/netlookup.c
Removed:
   trunk/source/rpc_client/cli_netlookup.c
Modified:
   trunk/source/Makefile.in


Changeset:
Modified: trunk/source/Makefile.in
===================================================================
--- trunk/source/Makefile.in	2005-12-19 04:17:41 UTC (rev 12348)
+++ trunk/source/Makefile.in	2005-12-19 04:19:04 UTC (rev 12349)
@@ -258,7 +258,7 @@
 	       rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o  \
 	       rpc_client/cli_ds.o rpc_client/cli_echo.o \
 	       rpc_client/cli_shutdown.o rpc_client/cli_svcctl.o \
-	       rpc_client/cli_unixinfo.o rpc_client/cli_netlookup.o
+	       rpc_client/cli_unixinfo.o
 
 REGOBJS_OBJ = registry/reg_objects.o
 
@@ -564,7 +564,8 @@
 	   utils/net_rpc_join.o utils/net_time.o utils/net_lookup.o \
 	   utils/net_cache.o utils/net_groupmap.o utils/net_idmap.o \
 	   utils/net_status.o utils/net_rpc_printer.o utils/net_rpc_rights.o \
-	   utils/net_rpc_service.o utils/net_rpc_registry.o utils/net_usershare.o
+	   utils/net_rpc_service.o utils/net_rpc_registry.o utils/net_usershare.o \
+	   utils/netlookup.o
 
 NET_OBJ = $(NET_OBJ1) $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
 	  $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \

Deleted: trunk/source/rpc_client/cli_netlookup.c
===================================================================
--- trunk/source/rpc_client/cli_netlookup.c	2005-12-19 04:17:41 UTC (rev 12348)
+++ trunk/source/rpc_client/cli_netlookup.c	2005-12-19 04:19:04 UTC (rev 12349)
@@ -1,183 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-
-   Name lookup.
-
-   Copyright (C) Jeremy Allison 2005
-
-   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
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   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.
-*/
-
-#include "includes.h"
-
-struct con_struct {
-	BOOL failed_connect;
-	struct cli_state *cli;
-	struct rpc_pipe_client *lsapipe;
-	POLICY_HND pol;
-};
-
-static struct con_struct *cs;
-
-static int cs_destructor(void *p)
-{
-	if (cs->cli) {
-		cli_shutdown(cs->cli);
-	}
-	cs = NULL;
-	return 0;
-}
-
-static struct con_struct *create_cs(TALLOC_CTX *ctx)
-{
-	NTSTATUS nt_status;
-	struct in_addr loopback_ip = *interpret_addr2("127.0.0.1");;
-
-	if (cs) {
-		if (cs->failed_connect) {
-			return NULL;
-		}
-		return cs;
-	}
-
-	cs = TALLOC_P(ctx, struct con_struct);
-	if (!cs) {
-		return NULL;
-	}
-
-	ZERO_STRUCTP(cs);
-	talloc_set_destructor(cs, cs_destructor);
-
-	/* Connect to localhost with given username/password. */
-	if (!cmdline_auth_info.got_pass) {
-		char *pass = getpass("Password:");
-		if (pass) {
-			pstrcpy(cmdline_auth_info.password, pass);
-		}
-	}
-
-	nt_status = cli_full_connection(&cs->cli, global_myname(), global_myname(),
-					&loopback_ip, 0,
-					"IPC$", "IPC",
-					cmdline_auth_info.username,
-					lp_workgroup(),
-					cmdline_auth_info.password,
-					cmdline_auth_info.use_kerberos ? CLI_FULL_CONNECTION_USE_KERBEROS : 0,
-					cmdline_auth_info.signing_state,NULL);
-
-	if (!NT_STATUS_IS_OK(nt_status)) {
-		DEBUG(2,("create_cs: Connect failed. Error was %s\n", nt_errstr(nt_status)));
-		cs->failed_connect = True;
-		return NULL;
-	}
-
-	cs->lsapipe = cli_rpc_pipe_open_noauth(cs->cli,
-					PI_LSARPC,
-					&nt_status);
-
-	if (cs->lsapipe == NULL) {
-		DEBUG(2,("create_cs: open LSA pipe failed. Error was %s\n", nt_errstr(nt_status)));
-		cs->failed_connect = True;
-		return NULL;
-	}
-
-	nt_status = rpccli_lsa_open_policy(cs->lsapipe, ctx, True,
-				SEC_RIGHTS_MAXIMUM_ALLOWED,
-				&cs->pol);
-
-	if (!NT_STATUS_IS_OK(nt_status)) {
-		DEBUG(2,("create_cs: rpccli_lsa_open_policy failed. Error was %s\n", nt_errstr(nt_status)));
-		cs->failed_connect = True;
-		return NULL;
-	}
-	
-	return cs;
-}
-
-static BOOL lookup_name_from_sid_via_localhost(TALLOC_CTX *ctx, DOM_SID *psid,
-						const char **ppdomain, const char **ppname, uint32 *ptype)
-{
-	NTSTATUS nt_status;
-	struct con_struct *csp = NULL;
-	char **domains;
-	char **names;
-	uint32 *types;
-
-	*ppdomain = NULL;
-	*ppname = NULL;
-	*ptype = (uint32)SID_NAME_UNKNOWN;
-
-	csp = create_cs(ctx);
-	if (csp == NULL) {
-		return False;
-	}
-
-	nt_status = rpccli_lsa_lookup_sids(csp->lsapipe, ctx,
-						&csp->pol,
-						1, psid,
-						&domains,
-						&names,
-						&types);
-
-	if (!NT_STATUS_IS_OK(nt_status)) {
-		return False;
-	}
-
-	*ppdomain = domains[0];
-	*ppname = names[0];
-	*ptype = types[0];
-	
-        /* Converted OK */
-        return True;
-}
-
-static BOOL lookup_name_from_sid_via_winbind(TALLOC_CTX *ctx, DOM_SID *psid, const char **ppdomain, const char **ppname)
-{
-	return False;
-}
-
-BOOL net_lookup_name_from_sid(TALLOC_CTX *ctx, DOM_SID *psid, const char **ppdomain, const char **ppname)
-{
-	uint32 sidtype;
-
-	/* Check if local and we don't need to look up ... */
-	if (lookup_wellknown_sid(ctx, psid, ppdomain, ppname)) {
-		return True;
-	}
-
-	/* Check if the local machine is authoritative for this sid. We can't
-	   check if this is our SID as that's stored in the root-read-only
-	   secrets.tdb. */
-
-	if (lookup_name_from_sid_via_localhost(ctx, psid, ppdomain, ppname, &sidtype)) {
-		/* Cache here.... */
-		return True;
-	}
-
-	/* Finally it may be a trusted domain sid, ask winbindd. */
-
-	if (lookup_name_from_sid_via_winbind(ctx, psid, ppdomain, ppname)) {
-		/* Cache here.... */
-		return True;
-	}
-
-	/* Can't map SID to name */
-	return False;
-}
-
-BOOL net_lookup_sid_from_name(TALLOC_CTX *ctx, const char *domain, const char *name, DOM_SID *pret_sid)
-{
-	return False;
-}

Copied: trunk/source/utils/netlookup.c (from rev 12346, trunk/source/rpc_client/cli_netlookup.c)



More information about the samba-cvs mailing list