registry/reg_shares.c

説明を見る。
00001 /* 
00002  *  Unix SMB/CIFS implementation.
00003  *  Virtual Windows Registry Layer
00004  *  Copyright (C) Gerald Carter                     2005
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *  
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *  
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 /* Implementation of registry virtual views for printing information */
00022 
00023 #include "includes.h"
00024 
00025 #undef DBGC_CLASS
00026 #define DBGC_CLASS DBGC_RPC_SRV
00027 
00028 /**********************************************************************
00029  It is safe to assume that every registry path passed into on of 
00030  the exported functions here begins with KEY_PRINTING else
00031  these functions would have never been called.  This is a small utility
00032  function to strip the beginning of the path and make a copy that the 
00033  caller can modify.  Note that the caller is responsible for releasing
00034  the memory allocated here.
00035  **********************************************************************/
00036 
00037 static char* trim_reg_path( const char *path )
00038 {
00039         const char *p;
00040         uint16 key_len = strlen(KEY_SHARES);
00041         
00042         /* 
00043          * sanity check...this really should never be True.
00044          * It is only here to prevent us from accessing outside
00045          * the path buffer in the extreme case.
00046          */
00047         
00048         if ( strlen(path) < key_len ) {
00049                 DEBUG(0,("trim_reg_path: Registry path too short! [%s]\n", path));
00050                 return NULL;
00051         }
00052         
00053         
00054         p = path + strlen( KEY_SHARES );
00055         
00056         if ( *p == '\\' )
00057                 p++;
00058         
00059         if ( *p )
00060                 return SMB_STRDUP(p);
00061         else
00062                 return NULL;
00063 }
00064 
00065 /**********************************************************************
00066  Enumerate registry subkey names given a registry path.  
00067  Caller is responsible for freeing memory to **subkeys
00068  *********************************************************************/
00069  
00070 static int shares_subkey_info( const char *key, REGSUBKEY_CTR *subkey_ctr )
00071 {
00072         char            *path;
00073         BOOL            top_level = False;
00074         int             num_subkeys = 0;
00075         
00076         DEBUG(10,("printing_subkey_info: key=>[%s]\n", key));
00077         
00078         path = trim_reg_path( key );
00079         
00080         /* check to see if we are dealing with the top level key */
00081         
00082         if ( !path )
00083                 top_level = True;
00084                 
00085         if ( top_level ) {
00086                 num_subkeys = 1;
00087                 regsubkey_ctr_addkey( subkey_ctr, "Security" );
00088         }
00089 #if 0
00090         else
00091                 num_subkeys = handle_share_subpath( path, subkey_ctr, NULL );
00092 #endif
00093         
00094         SAFE_FREE( path );
00095         
00096         return num_subkeys;
00097 }
00098 
00099 /**********************************************************************
00100  Enumerate registry values given a registry path.  
00101  Caller is responsible for freeing memory 
00102  *********************************************************************/
00103 
00104 static int shares_value_info( const char *key, REGVAL_CTR *val )
00105 {
00106         char            *path;
00107         BOOL            top_level = False;
00108         int             num_values = 0;
00109         
00110         DEBUG(10,("printing_value_info: key=>[%s]\n", key));
00111         
00112         path = trim_reg_path( key );
00113         
00114         /* check to see if we are dealing with the top level key */
00115         
00116         if ( !path )
00117                 top_level = True;
00118         
00119         /* fill in values from the getprinterdata_printer_server() */
00120         if ( top_level )
00121                 num_values = 0;
00122 #if 0
00123         else
00124                 num_values = handle_printing_subpath( path, NULL, val );
00125 #endif
00126                 
00127         SAFE_FREE(path);
00128         
00129         return num_values;
00130 }
00131 
00132 /**********************************************************************
00133  Stub function which always returns failure since we don't want
00134  people storing printing information directly via regostry calls
00135  (for now at least)
00136  *********************************************************************/
00137 
00138 static BOOL shares_store_subkey( const char *key, REGSUBKEY_CTR *subkeys )
00139 {
00140         return False;
00141 }
00142 
00143 /**********************************************************************
00144  Stub function which always returns failure since we don't want
00145  people storing printing information directly via regostry calls
00146  (for now at least)
00147  *********************************************************************/
00148 
00149 static BOOL shares_store_value( const char *key, REGVAL_CTR *val )
00150 {
00151         return False;
00152 }
00153 
00154 /* 
00155  * Table of function pointers for accessing printing data
00156  */
00157  
00158 REGISTRY_OPS shares_reg_ops = {
00159         shares_subkey_info,
00160         shares_value_info,
00161         shares_store_subkey,
00162         shares_store_value,
00163         NULL
00164 };
00165 
00166 

Sambaに対してSat Aug 29 21:23:15 2009に生成されました。  doxygen 1.4.7