summaryrefslogtreecommitdiff
path: root/source3/nsswitch/nss_info_template.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2007-01-24 01:48:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:23 -0500
commitb9b26be1744b792a54f0a77af140237b4dc5a870 (patch)
tree96501a60f415248f226902f790420dec7758a540 /source3/nsswitch/nss_info_template.c
parent78f5f4b260d877ce615dbbdc2bccbb0cd251f08a (diff)
downloadsamba-b9b26be1744b792a54f0a77af140237b4dc5a870.tar.gz
samba-b9b26be1744b792a54f0a77af140237b4dc5a870.tar.bz2
samba-b9b26be1744b792a54f0a77af140237b4dc5a870.zip
r20986: Commit the prototype of the nss_info plugin interface.
This allows a provider to supply the homedirectory, etc... attributes for a user without requiring support in core winbindd code. The idmap_ad.c module has been modified to provide the idmap 'ad' library as well as the rfc2307 and sfu "winbind nss info" support. The SID/id mapping is working in idmap_ad but the nss_info still has a few quirks that I'm in the process of resolving. (This used to be commit aaec0115e2c96935499052d9a637a20c6445986e)
Diffstat (limited to 'source3/nsswitch/nss_info_template.c')
-rw-r--r--source3/nsswitch/nss_info_template.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/source3/nsswitch/nss_info_template.c b/source3/nsswitch/nss_info_template.c
new file mode 100644
index 0000000000..e1076fbeaf
--- /dev/null
+++ b/source3/nsswitch/nss_info_template.c
@@ -0,0 +1,84 @@
+/*
+ Unix SMB/CIFS implementation.
+ idMap nss template plugin
+
+ Copyright (C) Gerald Carter 2006
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "includes.h"
+#include "nss_info.h"
+
+/************************************************************************
+ ***********************************************************************/
+
+static NTSTATUS nss_template_init( struct nss_domain_entry *e )
+{
+ return NT_STATUS_OK;
+}
+
+/************************************************************************
+ ***********************************************************************/
+
+static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
+ const DOM_SID *sid,
+ TALLOC_CTX *ctx,
+ ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ char **homedir,
+ char **shell,
+ char **gecos,
+ uint32 *gid )
+{
+ if ( !homedir || !shell || !gecos )
+ return NT_STATUS_INVALID_PARAMETER;
+
+ *homedir = talloc_strdup( ctx, lp_template_homedir() );
+ *shell = talloc_strdup( ctx, lp_template_shell() );
+ *gecos = NULL;
+
+ if ( !*homedir || !*shell ) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/************************************************************************
+ ***********************************************************************/
+
+static NTSTATUS nss_template_close( void )
+{
+ return NT_STATUS_OK;
+}
+
+
+/************************************************************************
+ ***********************************************************************/
+
+static struct nss_info_methods nss_template_methods = {
+ nss_template_init,
+ nss_template_get_info,
+ nss_template_close
+};
+
+NTSTATUS nss_info_template_init( void )
+{
+ return smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION,
+ "template",
+ &nss_template_methods);
+}