diff options
author | Günther Deschner <gd@samba.org> | 2007-10-05 22:34:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:07:50 -0500 |
commit | b591596c0e35b9705243d03faf9b22f8ebe51170 (patch) | |
tree | cb0d8fbd9fac1687ffa934fb379243a91527207b | |
parent | 5799692be7f734def9ea57d8d36bfb6c37803941 (diff) | |
download | samba-b591596c0e35b9705243d03faf9b22f8ebe51170.tar.gz samba-b591596c0e35b9705243d03faf9b22f8ebe51170.tar.bz2 samba-b591596c0e35b9705243d03faf9b22f8ebe51170.zip |
r25539: Also correct indent for winreg server.
Guenther
(This used to be commit 3f6cc36a1b7ac8c2c65cd19a08ec06314653cfd2)
-rw-r--r-- | source4/rpc_server/winreg/rpc_winreg.c | 358 |
1 files changed, 181 insertions, 177 deletions
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index d3d9977c12..3aea8e62c1 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. endpoint server for the winreg pipe Copyright (C) Jelmer Vernooij 2004 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -28,14 +28,15 @@ enum handle_types { HTYPE_REGVAL, HTYPE_REGKEY }; -static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call, - const struct dcesrv_interface *iface) +static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call, + const struct dcesrv_interface *iface) { struct registry_context *ctx; WERROR err; err = reg_open_samba(dce_call->context, - &ctx, dce_call->conn->auth_state.session_info, NULL); + &ctx, dce_call->conn->auth_state.session_info, + NULL); if (!W_ERROR_IS_OK(err)) { DEBUG(0, ("Error opening registry: %s\n", win_errstr(err))); @@ -49,24 +50,25 @@ static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call, #define DCESRV_INTERFACE_WINREG_BIND dcerpc_winreg_bind -static WERROR dcesrv_winreg_openhive(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, uint32_t hkey, - struct policy_handle **outh) +static WERROR dcesrv_winreg_openhive(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, uint32_t hkey, + struct policy_handle **outh) { struct registry_context *ctx = dce_call->context->private; - struct dcesrv_handle *h; + struct dcesrv_handle *h; WERROR error; - h = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY); + h = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY); - error = reg_get_predefined_key(ctx, hkey, (struct registry_key **)&h->data); + error = reg_get_predefined_key(ctx, hkey, + (struct registry_key **)&h->data); if (!W_ERROR_IS_OK(error)) { return error; } - - *outh = &h->wire_handle; - return error; + *outh = &h->wire_handle; + + return error; } #define func_winreg_OpenHive(k,n) static WERROR dcesrv_winreg_Open ## k (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_Open ## k *r) \ @@ -84,14 +86,14 @@ func_winreg_OpenHive(HKDD,HKEY_DYN_DATA) func_winreg_OpenHive(HKPT,HKEY_PERFORMANCE_TEXT) func_winreg_OpenHive(HKPN,HKEY_PERFORMANCE_NLSTEXT) -/* - winreg_CloseKey +/* + winreg_CloseKey */ -static WERROR dcesrv_winreg_CloseKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_CloseKey *r) +static WERROR dcesrv_winreg_CloseKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_CloseKey *r) { - struct dcesrv_handle *h; + struct dcesrv_handle *h; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); @@ -102,19 +104,19 @@ static WERROR dcesrv_winreg_CloseKey(struct dcesrv_call_state *dce_call, return WERR_OK; } -/* - winreg_CreateKey +/* + winreg_CreateKey */ -static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_CreateKey *r) +static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_CreateKey *r) { struct dcesrv_handle *h, *newh; WERROR error; struct security_descriptor sd; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); - + newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY); /* the security descriptor is optional */ @@ -126,16 +128,16 @@ static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call, if (sdblob.data == NULL) { return WERR_INVALID_PARAM; } - status = ndr_pull_struct_blob_all(&sdblob, mem_ctx, &sd, + status = ndr_pull_struct_blob_all(&sdblob, mem_ctx, &sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NT_STATUS_IS_OK(status)) { return WERR_INVALID_PARAM; } } - error = reg_key_add_name(newh, (struct registry_key *)h->data, - r->in.name.name, NULL, r->in.secdesc?&sd:NULL, - (struct registry_key **)&newh->data); + error = reg_key_add_name(newh, (struct registry_key *)h->data, + r->in.name.name, NULL, r->in.secdesc?&sd:NULL, + (struct registry_key **)&newh->data); if (W_ERROR_IS_OK(error)) { r->out.new_handle = &newh->wire_handle; } else { @@ -146,27 +148,27 @@ static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call, } -/* - winreg_DeleteKey +/* + winreg_DeleteKey */ -static WERROR dcesrv_winreg_DeleteKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_DeleteKey *r) +static WERROR dcesrv_winreg_DeleteKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_DeleteKey *r) { struct dcesrv_handle *h; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); - + return reg_key_del((struct registry_key *)h->data, r->in.key.name); } -/* - winreg_DeleteValue +/* + winreg_DeleteValue */ -static WERROR dcesrv_winreg_DeleteValue(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_DeleteValue *r) +static WERROR dcesrv_winreg_DeleteValue(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_DeleteValue *r) { struct dcesrv_handle *h; struct registry_key *key; @@ -174,17 +176,17 @@ static WERROR dcesrv_winreg_DeleteValue(struct dcesrv_call_state *dce_call, DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); key = h->data; - + return reg_del_value(key, r->in.value.name); } -/* - winreg_EnumKey +/* + winreg_EnumKey */ -static WERROR dcesrv_winreg_EnumKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_EnumKey *r) +static WERROR dcesrv_winreg_EnumKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_EnumKey *r) { struct dcesrv_handle *h; const char *name; @@ -192,9 +194,10 @@ static WERROR dcesrv_winreg_EnumKey(struct dcesrv_call_state *dce_call, DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); - r->out.result = reg_key_get_subkey_by_index(mem_ctx, - (struct registry_key *)h->data, r->in.enum_index, - &name, NULL, &last_mod); + r->out.result = reg_key_get_subkey_by_index(mem_ctx, + (struct registry_key *)h->data, + r->in.enum_index, + &name, NULL, &last_mod); if (W_ERROR_IS_OK(r->out.result)) { if (2*strlen_m_term(name) > r->in.name->size) { @@ -207,17 +210,17 @@ static WERROR dcesrv_winreg_EnumKey(struct dcesrv_call_state *dce_call, r->out.last_changed_time = &last_mod; } } - + return r->out.result; } -/* - winreg_EnumValue +/* + winreg_EnumValue */ -static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_EnumValue *r) +static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_EnumValue *r) { struct dcesrv_handle *h; struct registry_key *key; @@ -230,9 +233,9 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, key = h->data; - result = reg_key_get_value_by_index(mem_ctx, key, r->in.enum_index, - &data_name, - &data_type, &data); + result = reg_key_get_value_by_index(mem_ctx, key, r->in.enum_index, + &data_name, + &data_type, &data); if (!W_ERROR_IS_OK(result)) { return result; } @@ -246,14 +249,14 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, /* check the client has enough room for the value */ if (r->in.value != NULL && - r->in.size != NULL && + r->in.size != NULL && data.length > *r->in.size) { return WERR_MORE_DATA; } - + /* and enough room for the name */ if (r->in.name->size < 2*strlen_m_term(data_name)) { - return WERR_MORE_DATA; + return WERR_MORE_DATA; } r->out.name->name = data_name; @@ -269,17 +272,17 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, *r->out.size = data.length; r->out.length = r->out.size; } - + return WERR_OK; } -/* - winreg_FlushKey +/* + winreg_FlushKey */ -static WERROR dcesrv_winreg_FlushKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_FlushKey *r) +static WERROR dcesrv_winreg_FlushKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_FlushKey *r) { struct dcesrv_handle *h; @@ -289,12 +292,12 @@ static WERROR dcesrv_winreg_FlushKey(struct dcesrv_call_state *dce_call, } -/* - winreg_GetKeySecurity +/* + winreg_GetKeySecurity */ -static WERROR dcesrv_winreg_GetKeySecurity(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_GetKeySecurity *r) +static WERROR dcesrv_winreg_GetKeySecurity(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_GetKeySecurity *r) { struct dcesrv_handle *h; @@ -304,34 +307,34 @@ static WERROR dcesrv_winreg_GetKeySecurity(struct dcesrv_call_state *dce_call, } -/* - winreg_LoadKey +/* + winreg_LoadKey */ -static WERROR dcesrv_winreg_LoadKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_LoadKey *r) +static WERROR dcesrv_winreg_LoadKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_LoadKey *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_NotifyChangeKeyValue +/* + winreg_NotifyChangeKeyValue */ -static WERROR dcesrv_winreg_NotifyChangeKeyValue( - struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, struct winreg_NotifyChangeKeyValue *r) +static WERROR dcesrv_winreg_NotifyChangeKeyValue(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_NotifyChangeKeyValue *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_OpenKey +/* + winreg_OpenKey */ -static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_OpenKey *r) +static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_OpenKey *r) { struct dcesrv_handle *h, *newh; WERROR result; @@ -343,26 +346,27 @@ static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call, result = WERR_OK; } else { newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY); - result = reg_open_key(newh, (struct registry_key *)h->data, - r->in.keyname.name, (struct registry_key **)&newh->data); + result = reg_open_key(newh, (struct registry_key *)h->data, + r->in.keyname.name, + (struct registry_key **)&newh->data); } - + if (W_ERROR_IS_OK(result)) { - r->out.handle = &newh->wire_handle; + r->out.handle = &newh->wire_handle; } else { talloc_free(newh); } - + return result; } -/* - winreg_QueryInfoKey +/* + winreg_QueryInfoKey */ -static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_QueryInfoKey *r) +static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_QueryInfoKey *r) { struct dcesrv_handle *h; struct registry_key *k; @@ -373,8 +377,8 @@ static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call, k = h->data; - ret = reg_key_get_info(mem_ctx, k, &classname, r->out.num_subkeys, - r->out.num_values, r->out.last_changed_time); + ret = reg_key_get_info(mem_ctx, k, &classname, r->out.num_subkeys, + r->out.num_values, r->out.last_changed_time); if (r->out.classname != NULL) r->out.classname->name = classname; @@ -383,12 +387,12 @@ static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call, } -/* - winreg_QueryValue +/* + winreg_QueryValue */ -static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_QueryValue *r) +static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_QueryValue *r) { struct dcesrv_handle *h; struct registry_key *key; @@ -399,11 +403,11 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); key = h->data; - - result = reg_key_get_value_by_name(mem_ctx, key, r->in.value_name.name, - &value_type, &value_data); - if (!W_ERROR_IS_OK(result)) { + result = reg_key_get_value_by_name(mem_ctx, key, r->in.value_name.name, + &value_type, &value_data); + + if (!W_ERROR_IS_OK(result)) { return result; } @@ -430,56 +434,56 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, } -/* - winreg_ReplaceKey +/* + winreg_ReplaceKey */ -static WERROR dcesrv_winreg_ReplaceKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_ReplaceKey *r) +static WERROR dcesrv_winreg_ReplaceKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_ReplaceKey *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_RestoreKey +/* + winreg_RestoreKey */ -static WERROR dcesrv_winreg_RestoreKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_RestoreKey *r) +static WERROR dcesrv_winreg_RestoreKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_RestoreKey *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_SaveKey +/* + winreg_SaveKey */ -static WERROR dcesrv_winreg_SaveKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_SaveKey *r) +static WERROR dcesrv_winreg_SaveKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_SaveKey *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_SetKeySecurity +/* + winreg_SetKeySecurity */ -static WERROR dcesrv_winreg_SetKeySecurity(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_SetKeySecurity *r) +static WERROR dcesrv_winreg_SetKeySecurity(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_SetKeySecurity *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_SetValue +/* + winreg_SetValue */ -static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_SetValue *r) +static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_SetValue *r) { struct dcesrv_handle *h; struct registry_key *key; @@ -489,7 +493,7 @@ static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call, DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); key = h->data; - + data.data = r->in.data; data.length = r->in.size; result = reg_val_set(key, r->in.name.name, r->in.type, data); @@ -498,45 +502,45 @@ static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call, } -/* - winreg_UnLoadKey +/* + winreg_UnLoadKey */ -static WERROR dcesrv_winreg_UnLoadKey(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_UnLoadKey *r) +static WERROR dcesrv_winreg_UnLoadKey(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_UnLoadKey *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_InitiateSystemShutdown +/* + winreg_InitiateSystemShutdown */ -static WERROR dcesrv_winreg_InitiateSystemShutdown( - struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct winreg_InitiateSystemShutdown *r) +static WERROR dcesrv_winreg_InitiateSystemShutdown(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_InitiateSystemShutdown *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_AbortSystemShutdown +/* + winreg_AbortSystemShutdown */ -static WERROR dcesrv_winreg_AbortSystemShutdown( - struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct winreg_AbortSystemShutdown *r) +static WERROR dcesrv_winreg_AbortSystemShutdown(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_AbortSystemShutdown *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_GetVersion +/* + winreg_GetVersion */ -static WERROR dcesrv_winreg_GetVersion(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_GetVersion *r) +static WERROR dcesrv_winreg_GetVersion(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_GetVersion *r) { struct dcesrv_handle *h; @@ -551,45 +555,45 @@ static WERROR dcesrv_winreg_GetVersion(struct dcesrv_call_state *dce_call, } -/* - winreg_QueryMultipleValues +/* + winreg_QueryMultipleValues */ -static WERROR dcesrv_winreg_QueryMultipleValues( - struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct winreg_QueryMultipleValues *r) +static WERROR dcesrv_winreg_QueryMultipleValues(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_QueryMultipleValues *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_InitiateSystemShutdownEx +/* + winreg_InitiateSystemShutdownEx */ -static WERROR dcesrv_winreg_InitiateSystemShutdownEx( - struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct winreg_InitiateSystemShutdownEx *r) +static WERROR dcesrv_winreg_InitiateSystemShutdownEx(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_InitiateSystemShutdownEx *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_SaveKeyEx +/* + winreg_SaveKeyEx */ -static WERROR dcesrv_winreg_SaveKeyEx(struct dcesrv_call_state *dce_call, - TALLOC_CTX *mem_ctx, - struct winreg_SaveKeyEx *r) +static WERROR dcesrv_winreg_SaveKeyEx(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_SaveKeyEx *r) { return WERR_NOT_SUPPORTED; } -/* - winreg_QueryMultipleValues2 +/* + winreg_QueryMultipleValues2 */ -static WERROR dcesrv_winreg_QueryMultipleValues2( - struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct winreg_QueryMultipleValues2 *r) +static WERROR dcesrv_winreg_QueryMultipleValues2(struct dcesrv_call_state *dce_call, + TALLOC_CTX *mem_ctx, + struct winreg_QueryMultipleValues2 *r) { return WERR_NOT_SUPPORTED; } |