| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 | idMap nss template plugin
|
|---|
| 4 |
|
|---|
| 5 | Copyright (C) Gerald Carter 2006
|
|---|
| 6 |
|
|---|
| 7 | This library is free software; you can redistribute it and/or
|
|---|
| 8 | modify it under the terms of the GNU Library General Public
|
|---|
| 9 | License as published by the Free Software Foundation; either
|
|---|
| 10 | version 2 of the License, or (at your option) any later version.
|
|---|
| 11 |
|
|---|
| 12 | This library is distributed in the hope that it will be useful,
|
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 15 | Library General Public License for more details.
|
|---|
| 16 |
|
|---|
| 17 | You should have received a copy of the GNU Library General Public
|
|---|
| 18 | License along with this library; if not, write to the
|
|---|
| 19 | Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|---|
| 20 | Boston, MA 02111-1307, USA.
|
|---|
| 21 | */
|
|---|
| 22 |
|
|---|
| 23 | #include "includes.h"
|
|---|
| 24 | #include "nss_info.h"
|
|---|
| 25 |
|
|---|
| 26 | /************************************************************************
|
|---|
| 27 | ***********************************************************************/
|
|---|
| 28 |
|
|---|
| 29 | static NTSTATUS nss_template_init( struct nss_domain_entry *e )
|
|---|
| 30 | {
|
|---|
| 31 | return NT_STATUS_OK;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | /************************************************************************
|
|---|
| 35 | ***********************************************************************/
|
|---|
| 36 |
|
|---|
| 37 | static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
|
|---|
| 38 | const DOM_SID *sid,
|
|---|
| 39 | TALLOC_CTX *ctx,
|
|---|
| 40 | ADS_STRUCT *ads,
|
|---|
| 41 | LDAPMessage *msg,
|
|---|
| 42 | char **homedir,
|
|---|
| 43 | char **shell,
|
|---|
| 44 | char **gecos,
|
|---|
| 45 | gid_t *gid )
|
|---|
| 46 | {
|
|---|
| 47 | if ( !homedir || !shell || !gecos )
|
|---|
| 48 | return NT_STATUS_INVALID_PARAMETER;
|
|---|
| 49 |
|
|---|
| 50 | *homedir = talloc_strdup( ctx, lp_template_homedir() );
|
|---|
| 51 | *shell = talloc_strdup( ctx, lp_template_shell() );
|
|---|
| 52 | *gecos = NULL;
|
|---|
| 53 |
|
|---|
| 54 | if ( !*homedir || !*shell ) {
|
|---|
| 55 | return NT_STATUS_NO_MEMORY;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | return NT_STATUS_OK;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | /************************************************************************
|
|---|
| 62 | ***********************************************************************/
|
|---|
| 63 |
|
|---|
| 64 | static NTSTATUS nss_template_close( void )
|
|---|
| 65 | {
|
|---|
| 66 | return NT_STATUS_OK;
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | /************************************************************************
|
|---|
| 71 | ***********************************************************************/
|
|---|
| 72 |
|
|---|
| 73 | static struct nss_info_methods nss_template_methods = {
|
|---|
| 74 | .init = nss_template_init,
|
|---|
| 75 | .get_nss_info = nss_template_get_info,
|
|---|
| 76 | .close_fn = nss_template_close
|
|---|
| 77 | };
|
|---|
| 78 |
|
|---|
| 79 | NTSTATUS nss_info_template_init( void )
|
|---|
| 80 | {
|
|---|
| 81 | return smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION,
|
|---|
| 82 | "template",
|
|---|
| 83 | &nss_template_methods);
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|