Registry Functions


データ構造

struct  RegConnect
struct  RegOpenKey
struct  RegEnumKeys
struct  RegCreateKey
struct  RegDeleteKey
struct  RegDeleteValue
struct  RegQueryKeyInfo
struct  RegSaveKey
struct  RegQueryValue
struct  RegEnumValues
struct  RegSetValue
struct  RegGetVersion
struct  RegGetKeySecurity
struct  RegSetKeySecurity

関数

int cac_RegConnect (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegConnect *op)
 Opens a handle to the registry on the server
int cac_RegClose (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *key)
 Closes an open registry handle
int cac_RegOpenKey (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegOpenKey *op)
 Opens a registry key
int cac_RegEnumKeys (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumKeys *op)
 Enumerates Subkeys of a given key.
int cac_RegCreateKey (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegCreateKey *op)
 Creates a registry key, if the key already exists, it will be opened __Creating keys is not currently working__.
int cac_RegDeleteKey (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegDeleteKey *op)
 Deletes a subkey of an open key.
int cac_RegDeleteValue (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegDeleteValue *op)
 Deletes a registry value.
int cac_RegQueryKeyInfo (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegQueryKeyInfo *op)
 Retrieves information about an open key
int cac_RegSaveKey (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSaveKey *op)
 Saves a key to a file on the remote machine __Not currently working__.
int cac_RegQueryValue (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegQueryValue *op)
 Retrieves a value (type and data) _not currently working_.
int cac_RegEnumValues (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumValues *op)
 Enumerates a number of Registry values in an open registry key.
int cac_RegSetValue (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSetValue *op)
 Sets or creates value (type and data).
int cac_RegGetVersion (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegGetVersion *op)
 Retrieves the registry version number
int cac_RegGetKeySecurity (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegGetKeySecurity *op)
 Retrieves a key security descriptor.
int cac_RegSetKeySecurity (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSetKeySecurity *op)
 Sets the key security descriptor.

関数

int cac_RegConnect ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegConnect op 
)

Opens a handle to the registry on the server

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c28 行で定義されています。

参照先 _CACSERVERHANDLE::_internalRegConnect::accesscac_GetPipe()cac_GetServer()_SMBCSRV::clicli_rpc_pipe_open_noauth()CacServerHandleInternal::ctxerrRegConnect::inRegConnect::keyRegConnect::outCacServerHandleInternal::pipesRegConnect::rootrpccli_reg_connect()_CACSERVERHANDLE::statuswerror_to_ntstatus().

参照元 cac_RegOpenKey().

00030 {
00031         SMBCSRV *srv = NULL;
00032         struct rpc_pipe_client *pipe_hnd = NULL;
00033         POLICY_HND *key = NULL;
00034         WERROR err;
00035 
00036         if ( !hnd )
00037                 return CAC_FAILURE;
00038 
00039         if ( !hnd->_internal.ctx ) {
00040                 hnd->status = NT_STATUS_INVALID_HANDLE;
00041                 return CAC_FAILURE;
00042         }
00043 
00044         if ( !op || !op->in.root || !mem_ctx ) {
00045                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00046                 return CAC_FAILURE;
00047         }
00048 
00049         srv = cac_GetServer( hnd );
00050         if ( !srv ) {
00051                 hnd->status = NT_STATUS_INVALID_CONNECTION;
00052                 return CAC_FAILURE;
00053         }
00054 
00055         /*initialize for winreg pipe if we have to */
00056         if ( !hnd->_internal.pipes[PI_WINREG] ) {
00057                 if ( !
00058                      ( pipe_hnd =
00059                        cli_rpc_pipe_open_noauth( srv->cli, PI_WINREG,
00060                                                  &( hnd->status ) ) ) ) {
00061                         return CAC_FAILURE;
00062                 }
00063 
00064                 hnd->_internal.pipes[PI_WINREG] = True;
00065         }
00066 
00067         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00068         if ( !pipe_hnd ) {
00069                 hnd->status = NT_STATUS_INVALID_HANDLE;
00070                 return CAC_FAILURE;
00071         }
00072 
00073         key = talloc( mem_ctx, POLICY_HND );
00074         if ( !key ) {
00075                 hnd->status = NT_STATUS_NO_MEMORY;
00076                 return CAC_FAILURE;
00077         }
00078 
00079         err = rpccli_reg_connect( pipe_hnd, mem_ctx, op->in.root,
00080                                   op->in.access, key );
00081         hnd->status = werror_to_ntstatus( err );
00082 
00083         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00084                 return CAC_FAILURE;
00085         }
00086 
00087         op->out.key = key;
00088 
00089         return CAC_SUCCESS;
00090 }

int cac_RegClose ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
POLICY_HND key 
)

Closes an open registry handle

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
key The Key/Handle to close
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c92 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxerrCacServerHandleInternal::pipesrpccli_reg_close()_CACSERVERHANDLE::statuswerror_to_ntstatus().

参照元 cac_RegDeleteKey().

00094 {
00095         struct rpc_pipe_client *pipe_hnd = NULL;
00096         WERROR err;
00097 
00098         if ( !hnd )
00099                 return CAC_FAILURE;
00100 
00101         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00102                 hnd->status = NT_STATUS_INVALID_HANDLE;
00103                 return CAC_FAILURE;
00104         }
00105 
00106         if ( !key || !mem_ctx ) {
00107                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00108                 return CAC_FAILURE;
00109         }
00110 
00111         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00112         if ( !pipe_hnd ) {
00113                 hnd->status = NT_STATUS_INVALID_HANDLE;
00114                 return CAC_FAILURE;
00115         }
00116 
00117         err = rpccli_reg_close( pipe_hnd, mem_ctx, key );
00118         hnd->status = werror_to_ntstatus( err );
00119 
00120         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00121                 return CAC_FAILURE;
00122         }
00123 
00124         return CAC_SUCCESS;
00125 }

int cac_RegOpenKey ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegOpenKey op 
)

Opens a registry key

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

if they only specified the root key, return the key we just opened

cac_winreg.c127 行で定義されています。

参照先 _CACSERVERHANDLE::_internalRegConnect::accessRegOpenKey::accesscac_GetPipe()cac_ParseRegPath()cac_RegConnect()CacServerHandleInternal::ctxerrRegOpenKey::inRegConnect::inRegOpenKey::keyRegConnect::keyRegOpenKey::nameRegOpenKey::outRegConnect::outRegOpenKey::parent_keyRegConnect::rootrpccli_reg_close()rpccli_reg_open_entry()_CACSERVERHANDLE::statuswerror_to_ntstatus().

参照元 cac_RegCreateKey()cac_RegDeleteKey().

00129 {
00130         struct rpc_pipe_client *pipe_hnd = NULL;
00131         WERROR err;
00132 
00133         POLICY_HND *key_out;
00134         POLICY_HND *parent_key;
00135 
00136         char *key_name = NULL;
00137         uint32 reg_type = 0;
00138 
00139         struct RegConnect rc;
00140 
00141         if ( !hnd )
00142                 return CAC_FAILURE;
00143 
00144         if ( !hnd->_internal.ctx ) {
00145                 hnd->status = NT_STATUS_INVALID_HANDLE;
00146                 return CAC_FAILURE;
00147         }
00148 
00149         if ( !op || !op->in.name || !mem_ctx ) {
00150                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00151                 return CAC_FAILURE;
00152         }
00153 
00154 
00155         key_out = talloc( mem_ctx, POLICY_HND );
00156         if ( !key_out ) {
00157                 hnd->status = NT_STATUS_NO_MEMORY;
00158                 return CAC_FAILURE;
00159         }
00160 
00161         if ( !op->in.parent_key ) {
00162                 /*then we need to connect to the registry */
00163                 if ( !cac_ParseRegPath( op->in.name, &reg_type, &key_name ) ) {
00164                         hnd->status = NT_STATUS_INVALID_PARAMETER;
00165                         return CAC_FAILURE;
00166                 }
00167 
00168                 /*use cac_RegConnect because it handles the session setup */
00169                 ZERO_STRUCT( rc );
00170 
00171                 rc.in.access = op->in.access;
00172                 rc.in.root = reg_type;
00173 
00174                 if ( !cac_RegConnect( hnd, mem_ctx, &rc ) ) {
00175                         return CAC_FAILURE;
00176                 }
00177 
00178       /**if they only specified the root key, return the key we just opened*/
00179                 if ( key_name == NULL ) {
00180                         op->out.key = rc.out.key;
00181                         return CAC_SUCCESS;
00182                 }
00183 
00184                 parent_key = rc.out.key;
00185         } else {
00186                 parent_key = op->in.parent_key;
00187                 key_name = op->in.name;
00188         }
00189 
00190         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00191         if ( !pipe_hnd ) {
00192                 hnd->status = NT_STATUS_INVALID_HANDLE;
00193                 return CAC_FAILURE;
00194         }
00195 
00196         err = rpccli_reg_open_entry( pipe_hnd, mem_ctx, parent_key, key_name,
00197                                      op->in.access, key_out );
00198         hnd->status = werror_to_ntstatus( err );
00199 
00200         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00201                 return CAC_FAILURE;
00202         }
00203 
00204         if ( !op->in.parent_key ) {
00205                 /*then close the one that we opened above */
00206                 err = rpccli_reg_close( pipe_hnd, mem_ctx, parent_key );
00207                 hnd->status = werror_to_ntstatus( err );
00208 
00209                 if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00210                         return CAC_FAILURE;
00211                 }
00212         }
00213 
00214         op->out.key = key_out;
00215 
00216         return CAC_SUCCESS;
00217 }

int cac_RegEnumKeys ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegEnumKeys op 
)

Enumerates Subkeys of a given key.

Can be run in a loop. Example: while(cac_RegEnumKeys(hnd, mem_ctx, op)) { ... }

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
参照:
CAC_OP_FAILED()
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

the only way to know how many keys to expect is to assume max_keys keys will be found

cac_winreg.c219 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()RegEnumKeys::class_namesCacServerHandleInternal::ctxerrRegEnumKeys::inRegEnumKeys::keyRegEnumKeys::key_namesRegEnumKeys::max_keysRegEnumKeys::mod_timesRegEnumKeys::num_keysRegEnumKeys::outCacServerHandleInternal::pipesRegEnumKeys::resume_idxrpccli_reg_enum_key()_CACSERVERHANDLE::statustalloc_strdup()werror_to_ntstatus().

00221 {
00222         struct rpc_pipe_client *pipe_hnd = NULL;
00223         WERROR err;
00224 
00225         /*buffers for rpccli_reg_enum_key call */
00226         fstring key_name_in;
00227         fstring class_name_in;
00228 
00229         /*output buffers */
00230         char **key_names_out = NULL;
00231         char **class_names_out = NULL;
00232         time_t *mod_times_out = NULL;
00233         uint32 num_keys_out = 0;
00234         uint32 resume_idx = 0;
00235 
00236         if ( !hnd )
00237                 return CAC_FAILURE;
00238 
00239         /*this is to avoid useless rpc calls, if the last call exhausted all the keys, then we don't need to go through everything again */
00240         if ( NT_STATUS_V( hnd->status ) ==
00241              NT_STATUS_V( NT_STATUS_GUIDS_EXHAUSTED ) )
00242                 return CAC_FAILURE;
00243 
00244         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00245                 hnd->status = NT_STATUS_INVALID_HANDLE;
00246                 return CAC_FAILURE;
00247         }
00248 
00249         if ( !op || op->in.max_keys == 0 || !mem_ctx ) {
00250                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00251                 return CAC_FAILURE;
00252         }
00253 
00254         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00255         if ( !pipe_hnd ) {
00256                 hnd->status = NT_STATUS_INVALID_HANDLE;
00257                 return CAC_FAILURE;
00258         }
00259 
00260    /**the only way to know how many keys to expect is to assume max_keys keys will be found*/
00261         if (op->in.max_keys) {
00262                 key_names_out = TALLOC_ARRAY( mem_ctx, char *, op->in.max_keys );
00263                 if ( !key_names_out ) {
00264                         hnd->status = NT_STATUS_NO_MEMORY;
00265                         return CAC_FAILURE;
00266                 }
00267 
00268                 class_names_out = TALLOC_ARRAY( mem_ctx, char *, op->in.max_keys );
00269                 if ( !class_names_out ) {
00270                         hnd->status = NT_STATUS_NO_MEMORY;
00271                         TALLOC_FREE( key_names_out );
00272                         return CAC_FAILURE;
00273                 }
00274 
00275                 mod_times_out = TALLOC_ARRAY( mem_ctx, time_t, op->in.max_keys );
00276                 if ( !mod_times_out ) {
00277                         hnd->status = NT_STATUS_NO_MEMORY;
00278                         TALLOC_FREE( key_names_out );
00279                         TALLOC_FREE( class_names_out );
00280 
00281                         return CAC_FAILURE;
00282                 }
00283         } else {
00284                 key_names_out = NULL;
00285                 class_names_out = NULL;
00286                 mod_times_out = NULL;
00287         }
00288 
00289         resume_idx = op->out.resume_idx;
00290 
00291         do {
00292                 err = rpccli_reg_enum_key( pipe_hnd, mem_ctx, op->in.key,
00293                                            resume_idx, key_name_in,
00294                                            class_name_in,
00295                                            &mod_times_out[num_keys_out] );
00296                 hnd->status = werror_to_ntstatus( err );
00297 
00298                 if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00299                         /*don't increment any values */
00300                         break;
00301                 }
00302 
00303                 key_names_out[num_keys_out] =
00304                         talloc_strdup( mem_ctx, key_name_in );
00305 
00306                 class_names_out[num_keys_out] =
00307                         talloc_strdup( mem_ctx, class_name_in );
00308 
00309                 if ( !key_names_out[num_keys_out]
00310                      || !class_names_out[num_keys_out] ) {
00311                         hnd->status = NT_STATUS_NO_MEMORY;
00312                         break;
00313                 }
00314 
00315                 resume_idx++;
00316                 num_keys_out++;
00317         } while ( num_keys_out < op->in.max_keys );
00318 
00319         if ( CAC_OP_FAILED( hnd->status ) ) {
00320                 op->out.num_keys = 0;
00321                 return CAC_FAILURE;
00322         }
00323 
00324         op->out.resume_idx = resume_idx;
00325         op->out.num_keys = num_keys_out;
00326         op->out.key_names = key_names_out;
00327         op->out.class_names = class_names_out;
00328         op->out.mod_times = mod_times_out;
00329 
00330         return CAC_SUCCESS;
00331 }

int cac_RegCreateKey ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegCreateKey op 
)

Creates a registry key, if the key already exists, it will be opened __Creating keys is not currently working__.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parmeters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c333 行で定義されています。

参照先 _CACSERVERHANDLE::_internalRegOpenKey::accessRegCreateKey::accesscac_GetPipe()cac_RegOpenKey()RegCreateKey::class_nameCacServerHandleInternal::ctxerrRegCreateKey::inRegOpenKey::inRegCreateKey::keyRegOpenKey::keyRegCreateKey::key_nameRegOpenKey::nameRegCreateKey::outRegOpenKey::outRegCreateKey::parent_keyRegOpenKey::parent_keyrpccli_reg_create_key_ex()_CACSERVERHANDLE::statuswerror_to_ntstatus().

00335 {
00336         struct rpc_pipe_client *pipe_hnd = NULL;
00337         WERROR err;
00338 
00339         POLICY_HND *key_out;
00340 
00341         struct RegOpenKey rok;
00342 
00343         if ( !hnd )
00344                 return CAC_FAILURE;
00345 
00346         if ( !hnd->_internal.ctx ) {
00347                 hnd->status = NT_STATUS_INVALID_HANDLE;
00348                 return CAC_FAILURE;
00349         }
00350 
00351         if ( !op || !op->in.parent_key || !op->in.key_name || !mem_ctx ) {
00352                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00353                 return CAC_FAILURE;
00354         }
00355 
00356         /*first try to open the key - we use cac_RegOpenKey(). this doubles as a way to ensure the winreg pipe is initialized */
00357         ZERO_STRUCT( rok );
00358 
00359         rok.in.name = op->in.key_name;
00360         rok.in.access = op->in.access;
00361         rok.in.parent_key = op->in.parent_key;
00362 
00363         if ( cac_RegOpenKey( hnd, mem_ctx, &rok ) ) {
00364                 /*then we got the key, return */
00365                 op->out.key = rok.out.key;
00366                 return CAC_SUCCESS;
00367         }
00368 
00369         /*just be ultra-safe */
00370         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00371         if ( !pipe_hnd ) {
00372                 hnd->status = NT_STATUS_INVALID_HANDLE;
00373                 return CAC_FAILURE;
00374         }
00375 
00376         key_out = talloc( mem_ctx, POLICY_HND );
00377         if ( !key_out ) {
00378                 hnd->status = NT_STATUS_NO_MEMORY;
00379                 return CAC_FAILURE;
00380         }
00381 
00382         err = rpccli_reg_create_key_ex( pipe_hnd, mem_ctx, op->in.parent_key,
00383                                         op->in.key_name, op->in.class_name,
00384                                         op->in.access, key_out );
00385         hnd->status = werror_to_ntstatus( err );
00386 
00387         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00388                 return CAC_FAILURE;
00389         }
00390 
00391         op->out.key = key_out;
00392 
00393         return CAC_SUCCESS;
00394 
00395 }

int cac_RegDeleteKey ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegDeleteKey op 
)

Deletes a subkey of an open key.

Note: if you run this with op->in.recursive == True, and the operation fails, it may leave the key in an inconsistent state.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c455 行で定義されています。

参照先 _CACSERVERHANDLE::_internalRegOpenKey::accesscac_delete_subkeys_recursive()cac_GetPipe()cac_RegClose()cac_RegOpenKey()CacServerHandleInternal::ctxerrRegDeleteKey::inRegOpenKey::inRegOpenKey::keyRegDeleteKey::nameRegOpenKey::nameRegOpenKey::outRegDeleteKey::parent_keyRegOpenKey::parent_keyCacServerHandleInternal::pipesRegDeleteKey::recursiverpccli_reg_delete_key()_CACSERVERHANDLE::statuswerror_to_ntstatus().

00457 {
00458         struct rpc_pipe_client *pipe_hnd = NULL;
00459         WERROR err;
00460 
00461         if ( !hnd )
00462                 return CAC_FAILURE;
00463 
00464         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00465                 hnd->status = NT_STATUS_INVALID_HANDLE;
00466                 return CAC_FAILURE;
00467         }
00468 
00469         if ( !op || !op->in.parent_key || !op->in.name || !mem_ctx ) {
00470                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00471                 return CAC_FAILURE;
00472         }
00473 
00474         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00475         if ( !pipe_hnd ) {
00476                 hnd->status = NT_STATUS_INVALID_HANDLE;
00477                 return CAC_FAILURE;
00478         }
00479 
00480         if ( op->in.recursive ) {
00481                 /*first open the key, and then delete all of it's subkeys recursively */
00482                 struct RegOpenKey rok;
00483 
00484                 ZERO_STRUCT( rok );
00485 
00486                 rok.in.parent_key = op->in.parent_key;
00487                 rok.in.name = op->in.name;
00488                 rok.in.access = REG_KEY_ALL;
00489 
00490                 if ( !cac_RegOpenKey( hnd, mem_ctx, &rok ) )
00491                         return CAC_FAILURE;
00492 
00493                 err = cac_delete_subkeys_recursive( pipe_hnd, mem_ctx,
00494                                                     rok.out.key );
00495 
00496                 /*close the key that we opened */
00497                 cac_RegClose( hnd, mem_ctx, rok.out.key );
00498 
00499                 hnd->status = werror_to_ntstatus( err );
00500 
00501                 if ( NT_STATUS_V( hnd->status ) !=
00502                      NT_STATUS_V( NT_STATUS_GUIDS_EXHAUSTED )
00503                      && !NT_STATUS_IS_OK( hnd->status ) )
00504                         return CAC_FAILURE;
00505 
00506                 /*now go on to actually delete the key */
00507         }
00508 
00509         err = rpccli_reg_delete_key( pipe_hnd, mem_ctx, op->in.parent_key,
00510                                      op->in.name );
00511         hnd->status = werror_to_ntstatus( err );
00512 
00513         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00514                 return CAC_FAILURE;
00515         }
00516 
00517         return CAC_SUCCESS;
00518 }

int cac_RegDeleteValue ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegDeleteValue op 
)

Deletes a registry value.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c520 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxerrRegDeleteValue::inRegDeleteValue::nameRegDeleteValue::parent_keyCacServerHandleInternal::pipesrpccli_reg_delete_val()_CACSERVERHANDLE::statuswerror_to_ntstatus().

00522 {
00523         struct rpc_pipe_client *pipe_hnd = NULL;
00524         WERROR err;
00525 
00526         if ( !hnd )
00527                 return CAC_FAILURE;
00528 
00529         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00530                 hnd->status = NT_STATUS_INVALID_HANDLE;
00531                 return CAC_FAILURE;
00532         }
00533 
00534         if ( !op || !op->in.parent_key || !op->in.name || !mem_ctx ) {
00535                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00536                 return CAC_FAILURE;
00537         }
00538 
00539         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00540         if ( !pipe_hnd ) {
00541                 hnd->status = NT_STATUS_INVALID_HANDLE;
00542                 return CAC_FAILURE;
00543         }
00544 
00545         err = rpccli_reg_delete_val( pipe_hnd, mem_ctx, op->in.parent_key,
00546                                      op->in.name );
00547         hnd->status = werror_to_ntstatus( err );
00548 
00549         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00550                 return CAC_FAILURE;
00551         }
00552 
00553         return CAC_SUCCESS;
00554 }

int cac_RegQueryKeyInfo ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegQueryKeyInfo op 
)

Retrieves information about an open key

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c563 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()RegQueryKeyInfo::class_nameCacServerHandleInternal::ctxerrRegQueryKeyInfo::inRegQueryKeyInfo::keyRegQueryKeyInfo::last_write_timeRegQueryKeyInfo::longest_classRegQueryKeyInfo::longest_subkeyRegQueryKeyInfo::longest_value_dataRegQueryKeyInfo::longest_value_nament_time_to_unix()RegQueryKeyInfo::num_subkeysRegQueryKeyInfo::num_valuesRegQueryKeyInfo::outCacServerHandleInternal::pipesrpccli_reg_query_key()RegQueryKeyInfo::security_desc_size_CACSERVERHANDLE::statustalloc_strdup()werror_to_ntstatus().

00565 {
00566         struct rpc_pipe_client *pipe_hnd = NULL;
00567         WERROR err;
00568 
00569         char *class_name_out = NULL;
00570         uint32 class_len = 0;
00571         uint32 num_subkeys_out = 0;
00572         uint32 long_subkey_out = 0;
00573         uint32 long_class_out = 0;
00574         uint32 num_values_out = 0;
00575         uint32 long_value_out = 0;
00576         uint32 long_data_out = 0;
00577         uint32 secdesc_size = 0;
00578         NTTIME mod_time;
00579 
00580         if ( !hnd )
00581                 return CAC_FAILURE;
00582 
00583         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00584                 hnd->status = NT_STATUS_INVALID_HANDLE;
00585                 return CAC_FAILURE;
00586         }
00587 
00588         if ( !op || !op->in.key || !mem_ctx ) {
00589                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00590                 return CAC_FAILURE;
00591         }
00592 
00593         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00594         if ( !pipe_hnd ) {
00595                 hnd->status = NT_STATUS_INVALID_HANDLE;
00596                 return CAC_FAILURE;
00597         }
00598 
00599         err = rpccli_reg_query_key( pipe_hnd, mem_ctx, op->in.key,
00600                                     class_name_out,
00601                                     &class_len,
00602                                     &num_subkeys_out,
00603                                     &long_subkey_out,
00604                                     &long_class_out,
00605                                     &num_values_out,
00606                                     &long_value_out,
00607                                     &long_data_out,
00608                                     &secdesc_size, &mod_time );
00609 
00610         hnd->status = werror_to_ntstatus( err );
00611 
00612         if ( !NT_STATUS_IS_OK( hnd->status ) )
00613                 return CAC_FAILURE;
00614 
00615         if ( !class_name_out ) {
00616                 op->out.class_name = talloc_strdup( mem_ctx, "" );
00617         } else if ( class_len != 0 && class_name_out[class_len - 1] != '\0' ) {
00618                 /*then we need to add a '\0' */
00619                 op->out.class_name =
00620                         TALLOC_SIZE( mem_ctx,
00621                                      sizeof( char ) * ( class_len + 1 ) );
00622 
00623                 memcpy( op->out.class_name, class_name_out, class_len );
00624 
00625                 op->out.class_name[class_len] = '\0';
00626         } else {                /*then everything worked out fine in the function */
00627                 op->out.class_name = talloc_strdup( mem_ctx, class_name_out );
00628         }
00629 
00630         if ( !op->out.class_name ) {
00631                 hnd->status = NT_STATUS_NO_MEMORY;
00632                 return CAC_FAILURE;
00633         }
00634 
00635         op->out.num_subkeys = num_subkeys_out;
00636         op->out.longest_subkey = long_subkey_out;
00637         op->out.longest_class = long_class_out;
00638         op->out.num_values = num_values_out;
00639         op->out.longest_value_name = long_value_out;
00640         op->out.longest_value_data = long_data_out;
00641         op->out.security_desc_size = secdesc_size;
00642         op->out.last_write_time = nt_time_to_unix( &mod_time );
00643 
00644         return CAC_FAILURE;
00645 }

int cac_RegSaveKey ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegSaveKey op 
)

Saves a key to a file on the remote machine __Not currently working__.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c998 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxerrRegSaveKey::filenameRegSaveKey::inRegSaveKey::keyCacServerHandleInternal::pipesrpccli_reg_save_key()_CACSERVERHANDLE::statuswerror_to_ntstatus().

01000 {
01001         struct rpc_pipe_client *pipe_hnd = NULL;
01002         WERROR err;
01003 
01004         if ( !hnd )
01005                 return CAC_FAILURE;
01006 
01007         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
01008                 hnd->status = NT_STATUS_INVALID_HANDLE;
01009                 return CAC_FAILURE;
01010         }
01011 
01012         if ( !op || !op->in.key || !op->in.filename || !mem_ctx ) {
01013                 hnd->status = NT_STATUS_INVALID_PARAMETER;
01014                 return CAC_FAILURE;
01015         }
01016 
01017         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
01018         if ( !pipe_hnd ) {
01019                 hnd->status = NT_STATUS_INVALID_HANDLE;
01020                 return CAC_FAILURE;
01021         }
01022 
01023         err = rpccli_reg_save_key( pipe_hnd, mem_ctx, op->in.key,
01024                                    op->in.filename );
01025         hnd->status = werror_to_ntstatus( err );
01026 
01027 
01028         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
01029                 return CAC_FAILURE;
01030         }
01031 
01032         return CAC_SUCCESS;
01033 }

int cac_RegQueryValue ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegQueryValue op 
)

Retrieves a value (type and data) _not currently working_.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c648 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_MakeRegValueData()CacServerHandleInternal::ctxRegQueryValue::dataerrerrnoRegQueryValue::inRegQueryValue::keyRegQueryValue::outCacServerHandleInternal::pipesrpccli_reg_query_value()_CACSERVERHANDLE::statusRegQueryValue::typeRegQueryValue::val_namewerror_to_ntstatus().

00650 {
00651         struct rpc_pipe_client *pipe_hnd = NULL;
00652         WERROR err;
00653 
00654         uint32 val_type;
00655         REGVAL_BUFFER buffer;
00656         REG_VALUE_DATA *data_out = NULL;
00657 
00658         if ( !hnd )
00659                 return CAC_FAILURE;
00660 
00661         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00662                 hnd->status = NT_STATUS_INVALID_HANDLE;
00663                 return CAC_FAILURE;
00664         }
00665 
00666         if ( !op || !op->in.key || !op->in.val_name || !mem_ctx ) {
00667                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00668                 return CAC_FAILURE;
00669         }
00670 
00671         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00672         if ( !pipe_hnd ) {
00673                 hnd->status = NT_STATUS_INVALID_HANDLE;
00674                 return CAC_FAILURE;
00675         }
00676 
00677         err = rpccli_reg_query_value( pipe_hnd, mem_ctx, op->in.key,
00678                                       op->in.val_name, &val_type, &buffer );
00679         hnd->status = werror_to_ntstatus( err );
00680 
00681         if ( !NT_STATUS_IS_OK( hnd->status ) )
00682                 return CAC_FAILURE;
00683 
00684         data_out = cac_MakeRegValueData( mem_ctx, val_type, buffer );
00685         if ( !data_out ) {
00686                 if ( errno == ENOMEM )
00687                         hnd->status = NT_STATUS_NO_MEMORY;
00688                 else
00689                         hnd->status = NT_STATUS_INVALID_PARAMETER;
00690 
00691                 return CAC_FAILURE;
00692         }
00693 
00694         op->out.type = val_type;
00695         op->out.data = data_out;
00696 
00697         return CAC_SUCCESS;
00698 }

int cac_RegEnumValues ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegEnumValues op 
)

Enumerates a number of Registry values in an open registry key.

Can be run in a loop. Example: while(cac_RegEnumValues(hnd, mem_ctx, op)) { ... }

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
参照:
CAC_OP_FAILED()
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c701 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_MakeRegValueData()CacServerHandleInternal::ctxerrRegEnumValues::inRegEnumValues::keyRegEnumValues::max_valuesRegEnumValues::num_valuesRegEnumValues::outCacServerHandleInternal::pipesRegEnumValues::resume_idxrpccli_reg_enum_val()_CACSERVERHANDLE::statustalloc_strdup()RegEnumValues::typesRegEnumValues::value_namesRegEnumValues::valueswerror_to_ntstatus().

00703 {
00704         struct rpc_pipe_client *pipe_hnd = NULL;
00705         WERROR err;
00706 
00707         /*buffers for rpccli_reg_enum_key call */
00708         fstring val_name_buf;
00709         REGVAL_BUFFER val_buf;
00710 
00711         /*output buffers */
00712         uint32 *types_out = NULL;
00713         REG_VALUE_DATA **values_out = NULL;
00714         char **val_names_out = NULL;
00715         uint32 num_values_out = 0;
00716         uint32 resume_idx = 0;
00717 
00718         if ( !hnd )
00719                 return CAC_FAILURE;
00720 
00721         /*this is to avoid useless rpc calls, if the last call exhausted all the keys, then we don't need to go through everything again */
00722         if ( NT_STATUS_V( hnd->status ) ==
00723              NT_STATUS_V( NT_STATUS_GUIDS_EXHAUSTED ) )
00724                 return CAC_FAILURE;
00725 
00726         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00727                 hnd->status = NT_STATUS_INVALID_HANDLE;
00728                 return CAC_FAILURE;
00729         }
00730 
00731         if ( !op || !op->in.key || op->in.max_values == 0 || !mem_ctx ) {
00732                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00733                 return CAC_FAILURE;
00734         }
00735 
00736         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00737         if ( !pipe_hnd ) {
00738                 hnd->status = NT_STATUS_INVALID_HANDLE;
00739                 return CAC_FAILURE;
00740         }
00741 
00742         /*we need to assume that the max number of values will be enumerated */
00743         if (op->in.max_values) {
00744                 types_out =
00745                         ( uint32 * ) TALLOC_ARRAY( mem_ctx, int, op->in.max_values );
00746                 if ( !types_out ) {
00747                         hnd->status = NT_STATUS_NO_MEMORY;
00748                         return CAC_FAILURE;
00749                 }
00750 
00751                 values_out =
00752                         TALLOC_ARRAY( mem_ctx, REG_VALUE_DATA *, op->in.max_values );
00753                 if ( !values_out ) {
00754                         TALLOC_FREE( types_out );
00755                         hnd->status = NT_STATUS_NO_MEMORY;
00756                         return CAC_FAILURE;
00757                 }
00758 
00759                 val_names_out = TALLOC_ARRAY( mem_ctx, char *, op->in.max_values );
00760                 if ( !val_names_out ) {
00761                         TALLOC_FREE( types_out );
00762                         TALLOC_FREE( values_out );
00763                         hnd->status = NT_STATUS_NO_MEMORY;
00764                         return CAC_FAILURE;
00765                 }
00766         } else {
00767                 types_out = NULL;
00768                 values_out = NULL;
00769                 val_names_out = NULL;
00770         }
00771 
00772         resume_idx = op->out.resume_idx;
00773         do {
00774                 ZERO_STRUCT( val_buf );
00775 
00776                 err = rpccli_reg_enum_val( pipe_hnd, mem_ctx, op->in.key,
00777                                            resume_idx, val_name_buf,
00778                                            &types_out[num_values_out],
00779                                            &val_buf );
00780                 hnd->status = werror_to_ntstatus( err );
00781 
00782                 if ( !NT_STATUS_IS_OK( hnd->status ) )
00783                         break;
00784 
00785                 values_out[num_values_out] =
00786                         cac_MakeRegValueData( mem_ctx,
00787                                               types_out[num_values_out],
00788                                               val_buf );
00789                 val_names_out[num_values_out] =
00790                         talloc_strdup( mem_ctx, val_name_buf );
00791 
00792                 if ( !val_names_out[num_values_out]
00793                      || !values_out[num_values_out] ) {
00794                         hnd->status = NT_STATUS_NO_MEMORY;
00795                         break;
00796                 }
00797 
00798                 num_values_out++;
00799                 resume_idx++;
00800         } while ( num_values_out < op->in.max_values );
00801 
00802         if ( CAC_OP_FAILED( hnd->status ) )
00803                 return CAC_FAILURE;
00804 
00805         op->out.types = types_out;
00806         op->out.num_values = num_values_out;
00807         op->out.value_names = val_names_out;
00808         op->out.values = values_out;
00809         op->out.resume_idx = resume_idx;
00810 
00811         return CAC_SUCCESS;
00812 }

int cac_RegSetValue ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegSetValue op 
)

Sets or creates value (type and data).

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c814 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_MakeRpcDataBlob()CacServerHandleInternal::ctxerrerrnoRegSetValue::inRegSetValue::keyCacServerHandleInternal::pipesrpccli_reg_flush_key()rpccli_reg_set_val()_CACSERVERHANDLE::statusRegSetValue::typeRegSetValue::val_nameRegSetValue::valuewerror_to_ntstatus().

00816 {
00817         struct rpc_pipe_client *pipe_hnd = NULL;
00818         WERROR err;
00819 
00820         RPC_DATA_BLOB *buffer;
00821 
00822         if ( !hnd )
00823                 return CAC_FAILURE;
00824 
00825         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00826                 hnd->status = NT_STATUS_INVALID_HANDLE;
00827                 return CAC_FAILURE;
00828         }
00829 
00830         if ( !op || !op->in.key || !op->in.val_name || !mem_ctx ) {
00831                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00832                 return CAC_FAILURE;
00833         }
00834 
00835         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00836         if ( !pipe_hnd ) {
00837                 hnd->status = NT_STATUS_INVALID_HANDLE;
00838                 return CAC_FAILURE;
00839         }
00840 
00841         buffer = cac_MakeRpcDataBlob( mem_ctx, op->in.type, op->in.value );
00842 
00843         if ( !buffer ) {
00844                 if ( errno == ENOMEM )
00845                         hnd->status = NT_STATUS_NO_MEMORY;
00846                 else
00847                         hnd->status = NT_STATUS_INVALID_PARAMETER;
00848 
00849                 return CAC_FAILURE;
00850         }
00851 
00852         err = rpccli_reg_set_val( pipe_hnd, mem_ctx, op->in.key,
00853                                   op->in.val_name, op->in.type, buffer );
00854         hnd->status = werror_to_ntstatus( err );
00855 
00856         if ( !NT_STATUS_IS_OK( hnd->status ) )
00857                 return CAC_FAILURE;
00858 
00859         /*flush */
00860         err = rpccli_reg_flush_key( pipe_hnd, mem_ctx, op->in.key );
00861         hnd->status = werror_to_ntstatus( err );
00862 
00863         if ( !NT_STATUS_IS_OK( hnd->status ) )
00864                 return CAC_FAILURE;
00865 
00866         return CAC_SUCCESS;
00867 }

int cac_RegGetVersion ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegGetVersion op 
)

Retrieves the registry version number

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c871 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxerrRegGetVersion::inRegGetVersion::keyRegGetVersion::outCacServerHandleInternal::pipesrpccli_reg_getversion()_CACSERVERHANDLE::statusRegGetVersion::versionwerror_to_ntstatus().

00873 {
00874         struct rpc_pipe_client *pipe_hnd = NULL;
00875         WERROR err;
00876 
00877         uint32 version_out;
00878 
00879         if ( !hnd )
00880                 return CAC_FAILURE;
00881 
00882         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00883                 hnd->status = NT_STATUS_INVALID_HANDLE;
00884                 return CAC_FAILURE;
00885         }
00886 
00887         if ( !op || !op->in.key || !mem_ctx ) {
00888                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00889                 return CAC_FAILURE;
00890         }
00891 
00892         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00893         if ( !pipe_hnd ) {
00894                 hnd->status = NT_STATUS_INVALID_HANDLE;
00895                 return CAC_FAILURE;
00896         }
00897 
00898         err = rpccli_reg_getversion( pipe_hnd, mem_ctx, op->in.key,
00899                                      &version_out );
00900         hnd->status = werror_to_ntstatus( err );
00901 
00902         if ( !NT_STATUS_IS_OK( hnd->status ) )
00903                 return CAC_FAILURE;
00904 
00905         op->out.version = version_out;
00906 
00907         return CAC_SUCCESS;
00908 }

int cac_RegGetKeySecurity ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegGetKeySecurity op 
)

Retrieves a key security descriptor.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c910 行で定義されています。

参照先 _CACSERVERHANDLE::_internalbufcac_GetPipe()CacServerHandleInternal::ctxRegGetKeySecurity::descriptordup_sec_desc()errRegGetKeySecurity::inRegGetKeySecurity::info_typeRegGetKeySecurity::keyRegGetKeySecurity::outCacServerHandleInternal::pipesrpccli_reg_get_key_sec()RegGetKeySecurity::size_CACSERVERHANDLE::statuswerror_to_ntstatus().

00912 {
00913         struct rpc_pipe_client *pipe_hnd = NULL;
00914         WERROR err;
00915 
00916         uint32 buf_size;
00917         SEC_DESC_BUF buf;
00918 
00919         ZERO_STRUCT( buf );
00920 
00921         if ( !hnd )
00922                 return CAC_FAILURE;
00923 
00924         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00925                 hnd->status = NT_STATUS_INVALID_HANDLE;
00926                 return CAC_FAILURE;
00927         }
00928 
00929         if ( !op || !op->in.key || op->in.info_type == 0 || !mem_ctx ) {
00930                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00931                 return CAC_FAILURE;
00932         }
00933 
00934         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00935         if ( !pipe_hnd ) {
00936                 hnd->status = NT_STATUS_INVALID_HANDLE;
00937                 return CAC_FAILURE;
00938         }
00939 
00940         err = rpccli_reg_get_key_sec( pipe_hnd, mem_ctx, op->in.key,
00941                                       op->in.info_type, &buf_size, &buf );
00942         hnd->status = werror_to_ntstatus( err );
00943 
00944 
00945         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00946                 return CAC_FAILURE;
00947         }
00948 
00949         op->out.size = buf.len;
00950         op->out.descriptor = dup_sec_desc( mem_ctx, buf.sec );
00951 
00952         if ( op->out.descriptor == NULL ) {
00953                 return CAC_FAILURE;
00954         }
00955 
00956         return CAC_SUCCESS;
00957 }

int cac_RegSetKeySecurity ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct RegSetKeySecurity op 
)

Sets the key security descriptor.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code

CAC_SUCCESS The operation completed successfully

cac_winreg.c959 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxRegSetKeySecurity::descriptorerrRegSetKeySecurity::inRegSetKeySecurity::info_typeRegSetKeySecurity::keyCacServerHandleInternal::pipesrpccli_reg_set_key_sec()RegSetKeySecurity::size_CACSERVERHANDLE::statuswerror_to_ntstatus().

00961 {
00962         struct rpc_pipe_client *pipe_hnd = NULL;
00963         WERROR err;
00964 
00965         if ( !hnd )
00966                 return CAC_FAILURE;
00967 
00968         if ( !hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG] ) {
00969                 hnd->status = NT_STATUS_INVALID_HANDLE;
00970                 return CAC_FAILURE;
00971         }
00972 
00973         if ( !op || !op->in.key || op->in.info_type == 0 || op->in.size == 0
00974              || !op->in.descriptor || !mem_ctx ) {
00975                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00976                 return CAC_FAILURE;
00977         }
00978 
00979         pipe_hnd = cac_GetPipe( hnd, PI_WINREG );
00980         if ( !pipe_hnd ) {
00981                 hnd->status = NT_STATUS_INVALID_HANDLE;
00982                 return CAC_FAILURE;
00983         }
00984 
00985         err = rpccli_reg_set_key_sec( pipe_hnd, mem_ctx, op->in.key,
00986                                       op->in.info_type, op->in.size,
00987                                       op->in.descriptor );
00988         hnd->status = werror_to_ntstatus( err );
00989 
00990 
00991         if ( !NT_STATUS_IS_OK( hnd->status ) ) {
00992                 return CAC_FAILURE;
00993         }
00994 
00995         return CAC_SUCCESS;
00996 }


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