root/source3/winbindd/nss_info_template.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. nss_template_init
  2. nss_template_get_info
  3. nss_template_map_to_alias
  4. nss_template_map_from_alias
  5. nss_template_close
  6. nss_info_template_init

   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 Lesser General Public
   9    License as published by the Free Software Foundation; either
  10    version 3 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 Lesser General Public License
  18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19 */
  20 
  21 #include "includes.h"
  22 #include "nss_info.h"
  23 
  24 /************************************************************************
  25  ***********************************************************************/
  26 
  27 static NTSTATUS nss_template_init( struct nss_domain_entry *e )
     /* [<][>][^][v][top][bottom][index][help] */
  28 {
  29         return NT_STATUS_OK;
  30 }
  31 
  32 /************************************************************************
  33  ***********************************************************************/
  34 
  35 static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
     /* [<][>][^][v][top][bottom][index][help] */
  36                                        const DOM_SID *sid, 
  37                                        TALLOC_CTX *ctx,
  38                                        ADS_STRUCT *ads,
  39                                        LDAPMessage *msg,
  40                                        char **homedir,
  41                                        char **shell, 
  42                                        char **gecos,
  43                                        gid_t *gid )
  44 {     
  45         if ( !homedir || !shell || !gecos )
  46                 return NT_STATUS_INVALID_PARAMETER;
  47         
  48         /* protect against home directories using whitespace in the
  49           username */
  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_map_to_alias( TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
  65                                            struct nss_domain_entry *e,
  66                                            const char *name,
  67                                            char **alias )
  68 {
  69         return NT_STATUS_NOT_IMPLEMENTED;
  70 }
  71 
  72 /**********************************************************************
  73  *********************************************************************/
  74 
  75 static NTSTATUS nss_template_map_from_alias( TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
  76                                              struct nss_domain_entry *e,
  77                                              const char *alias,
  78                                              char **name )
  79 {
  80         return NT_STATUS_NOT_IMPLEMENTED;
  81 }
  82 
  83 /************************************************************************
  84  ***********************************************************************/
  85 
  86 static NTSTATUS nss_template_close( void )
     /* [<][>][^][v][top][bottom][index][help] */
  87 {
  88         return NT_STATUS_OK;
  89 }
  90 
  91 
  92 /************************************************************************
  93  ***********************************************************************/
  94 
  95 static struct nss_info_methods nss_template_methods = {
  96         .init           = nss_template_init,
  97         .get_nss_info   = nss_template_get_info,
  98         .map_to_alias   = nss_template_map_to_alias,
  99         .map_from_alias = nss_template_map_from_alias,
 100         .close_fn       = nss_template_close
 101 };
 102                 
 103 NTSTATUS nss_info_template_init( void )
     /* [<][>][^][v][top][bottom][index][help] */
 104 {
 105         return smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION, 
 106                                       "template", 
 107                                       &nss_template_methods);   
 108 }
 109 

/* [<][>][^][v][top][bottom][index][help] */