rpc_server/srv_ntsvcs_nt.c

説明を見る。
00001 /* 
00002  *  Unix SMB/CIFS implementation.
00003  *  RPC Pipe client / server routines
00004  *
00005  *  Copyright (C) Gerald (Jerry) Carter             2005.
00006  *  
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *  
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *  
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 
00022 #include "includes.h"
00023 
00024 #undef DBGC_CLASS
00025 #define DBGC_CLASS DBGC_RPC_SRV
00026 
00027 /********************************************************************
00028 ********************************************************************/
00029 
00030 static char* get_device_path( const char *device )
00031 {
00032         static pstring path;
00033 
00034         pstr_sprintf( path, "ROOT\\Legacy_%s\\0000", device );
00035 
00036         return path;
00037 }
00038 
00039 /********************************************************************
00040 ********************************************************************/
00041 
00042 WERROR _ntsvcs_get_version( pipes_struct *p, NTSVCS_Q_GET_VERSION *q_u, NTSVCS_R_GET_VERSION *r_u )
00043 {
00044         r_u->version = 0x00000400;      /* no idea what this means */
00045                 
00046         return WERR_OK;
00047 }
00048 
00049 /********************************************************************
00050 ********************************************************************/
00051 
00052 WERROR _ntsvcs_get_device_list_size( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u )
00053 {
00054         fstring device;
00055         const char *devicepath;
00056 
00057         if ( !q_u->devicename )
00058                 return WERR_ACCESS_DENIED;
00059 
00060         rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
00061         devicepath = get_device_path( device );
00062 
00063         r_u->size = strlen(devicepath) + 2;
00064 
00065         return WERR_OK;
00066 }
00067 
00068 
00069 /********************************************************************
00070 ********************************************************************/
00071 
00072 WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u )
00073 {
00074         fstring device;
00075         const char *devicepath;
00076 
00077         if ( !q_u->devicename )
00078                 return WERR_ACCESS_DENIED;
00079 
00080         rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
00081         devicepath = get_device_path( device );
00082 
00083         /* This has to be DOUBLE NULL terminated */
00084 
00085         init_unistr2( &r_u->devicepath, devicepath, UNI_STR_DBLTERMINATE );
00086         r_u->needed = r_u->devicepath.uni_str_len;
00087 
00088         return WERR_OK;
00089 }
00090 
00091 /********************************************************************
00092 ********************************************************************/
00093 
00094 WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u )
00095 {
00096         fstring devicepath;
00097         char *ptr;
00098         REGVAL_CTR *values;
00099         REGISTRY_VALUE *val;
00100 
00101         rpcstr_pull(devicepath, q_u->devicepath.buffer, sizeof(devicepath), q_u->devicepath.uni_str_len*2, 0);
00102 
00103         switch( q_u->property ) {
00104         case DEV_REGPROP_DESC:
00105                 /* just parse the service name from the device path and then 
00106                    lookup the display name */
00107                 if ( !(ptr = strrchr_m( devicepath, '\\' )) )
00108                         return WERR_GENERAL_FAILURE;    
00109                 *ptr = '\0';
00110                 
00111                 if ( !(ptr = strrchr_m( devicepath, '_' )) )
00112                         return WERR_GENERAL_FAILURE;    
00113                 ptr++;
00114                 
00115                 if ( !(values = svcctl_fetch_regvalues( ptr, p->pipe_user.nt_user_token )) )
00116                         return WERR_GENERAL_FAILURE;    
00117                 
00118                 if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) ) {
00119                         TALLOC_FREE( values );
00120                         return WERR_GENERAL_FAILURE;
00121                 }
00122                 
00123                 r_u->unknown1 = 0x1;    /* always 1...tested using a remove device manager connection */
00124                 r_u->size = reg_init_regval_buffer( &r_u->value, val );
00125                 r_u->needed = r_u->size;
00126 
00127                 TALLOC_FREE(values);
00128 
00129                 break;
00130                 
00131         default:
00132                 r_u->unknown1 = 0x00437c98;
00133                 return WERR_CM_NO_SUCH_VALUE;
00134         }
00135 
00136         return WERR_OK;
00137 }
00138 
00139 /********************************************************************
00140 ********************************************************************/
00141 
00142 WERROR _ntsvcs_validate_device_instance( pipes_struct *p, NTSVCS_Q_VALIDATE_DEVICE_INSTANCE *q_u, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u )
00143 {
00144         /* whatever dude */
00145         return WERR_OK;
00146 }
00147 
00148 /********************************************************************
00149 ********************************************************************/
00150 
00151 WERROR _ntsvcs_get_hw_profile_info( pipes_struct *p, NTSVCS_Q_GET_HW_PROFILE_INFO *q_u, NTSVCS_R_GET_HW_PROFILE_INFO *r_u )
00152 {
00153         /* steal the incoming buffer */
00154 
00155         r_u->buffer_size = q_u->buffer_size;
00156         r_u->buffer = q_u->buffer;
00157 
00158         /* Take the 5th Ammentment */
00159 
00160         return WERR_CM_NO_MORE_HW_PROFILES;
00161 }
00162 
00163 /********************************************************************
00164 ********************************************************************/
00165 
00166 WERROR _ntsvcs_hw_profile_flags( pipes_struct *p, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, NTSVCS_R_HW_PROFILE_FLAGS *r_u )
00167 {       
00168         /* just nod your head */
00169         
00170         return WERR_OK;
00171 }
00172 

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