[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Sun Feb 7 04:30:12 MST 2010
The branch, master has been updated
via 6e510b4... s3: Make cli_get_fs_volume_info() use cli_trans()
via c73ffb7... s3: Remove some unused code
via ff2d7d9... s3: Fix some comments
via 5552b44... s3: Fix some nonempty blank lines
via e2ddda3... libwbclient: wbc_create_logon_info is always called with mem_ctx==NULL
via 2607dc5... libwbclient: wbc_create_password_policy_info is always called with mem_ctx==NULL
via 1b2aad2... libwbclient: wbc_create_error_info is always called with mem_ctx==NULL
from 5ab6a8d... s4-registry: fixed byte order assumptions
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 6e510b49c03be9caba4f587f3f6cec547841b0d7
Author: Volker Lendecke <vl at samba.org>
Date: Sun Feb 7 12:08:39 2010 +0100
s3: Make cli_get_fs_volume_info() use cli_trans()
commit c73ffb728099e453110ffeb0e665811b9fcec34d
Author: Volker Lendecke <vl at samba.org>
Date: Sun Feb 7 12:01:36 2010 +0100
s3: Remove some unused code
commit ff2d7d9b82a2c03cf193ed346198d396525063bc
Author: Volker Lendecke <vl at samba.org>
Date: Sun Feb 7 11:14:22 2010 +0100
s3: Fix some comments
commit 5552b44960c5bb95f6478b41b42d7537d03cd8fd
Author: Volker Lendecke <vl at samba.org>
Date: Sun Feb 7 11:05:07 2010 +0100
s3: Fix some nonempty blank lines
commit e2ddda32897f96a336aa1c0f6198381a2843dd04
Author: Volker Lendecke <vl at samba.org>
Date: Sat Feb 6 16:56:29 2010 +0100
libwbclient: wbc_create_logon_info is always called with mem_ctx==NULL
commit 2607dc5ee87c84fc6b1419e5207f2ffaa5714af4
Author: Volker Lendecke <vl at samba.org>
Date: Sat Feb 6 16:54:05 2010 +0100
libwbclient: wbc_create_password_policy_info is always called with mem_ctx==NULL
commit 1b2aad29a837d04580ee4ab5336b65cfb172ed1d
Author: Volker Lendecke <vl at samba.org>
Date: Sat Feb 6 16:53:07 2010 +0100
libwbclient: wbc_create_error_info is always called with mem_ctx==NULL
-----------------------------------------------------------------------
Summary of changes:
nsswitch/libwbclient/wbc_pam.c | 47 ++++--------
source3/client/client.c | 7 +-
source3/include/proto.h | 4 +-
source3/libsmb/clifsinfo.c | 122 ++++++-------------------------
source3/registry/reg_api.c | 8 +-
source3/registry/reg_backend_printing.c | 92 ++++++++++++------------
source3/registry/reg_backend_shares.c | 4 +-
7 files changed, 100 insertions(+), 184 deletions(-)
Changeset truncated at 500 lines:
diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index 24b3ef6..fdb297f 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -207,14 +207,13 @@ done:
return wbc_status;
}
-static wbcErr wbc_create_error_info(TALLOC_CTX *mem_ctx,
- const struct winbindd_response *resp,
- struct wbcAuthErrorInfo **_e)
+static wbcErr wbc_create_error_info(const struct winbindd_response *resp,
+ struct wbcAuthErrorInfo **_e)
{
wbcErr wbc_status = WBC_ERR_SUCCESS;
struct wbcAuthErrorInfo *e;
- e = talloc(mem_ctx, struct wbcAuthErrorInfo);
+ e = talloc(NULL, struct wbcAuthErrorInfo);
BAIL_ON_PTR_ERROR(e, wbc_status);
e->nt_status = resp->data.auth.nt_status;
@@ -233,14 +232,13 @@ done:
return wbc_status;
}
-static wbcErr wbc_create_password_policy_info(TALLOC_CTX *mem_ctx,
- const struct winbindd_response *resp,
+static wbcErr wbc_create_password_policy_info(const struct winbindd_response *resp,
struct wbcUserPasswordPolicyInfo **_i)
{
wbcErr wbc_status = WBC_ERR_SUCCESS;
struct wbcUserPasswordPolicyInfo *i;
- i = talloc(mem_ctx, struct wbcUserPasswordPolicyInfo);
+ i = talloc(NULL, struct wbcUserPasswordPolicyInfo);
BAIL_ON_PTR_ERROR(i, wbc_status);
i->min_passwordage = resp->data.auth.policy.min_passwordage;
@@ -257,14 +255,13 @@ done:
return wbc_status;
}
-static wbcErr wbc_create_logon_info(TALLOC_CTX *mem_ctx,
- struct winbindd_response *resp,
+static wbcErr wbc_create_logon_info(struct winbindd_response *resp,
struct wbcLogonUserInfo **_i)
{
wbcErr wbc_status = WBC_ERR_SUCCESS;
struct wbcLogonUserInfo *i;
- i = talloc_zero(mem_ctx, struct wbcLogonUserInfo);
+ i = talloc_zero(NULL, struct wbcLogonUserInfo);
BAIL_ON_PTR_ERROR(i, wbc_status);
wbc_status = wbc_create_auth_info(i, resp, &i->info);
@@ -469,8 +466,7 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
&response);
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -518,8 +514,7 @@ wbcErr wbcCheckTrustCredentials(const char *domain,
&response);
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -556,8 +551,7 @@ wbcErr wbcChangeTrustCredentials(const char *domain,
&response);
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -600,8 +594,7 @@ wbcErr wbcPingDc(const char *domain, struct wbcAuthErrorInfo **error)
&response);
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -687,8 +680,7 @@ wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
/* Take the response above and return it to the caller */
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -916,8 +908,7 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -925,8 +916,7 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
}
if (policy) {
- wbc_status = wbc_create_password_policy_info(NULL,
- &response,
+ wbc_status = wbc_create_password_policy_info(&response,
policy);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -1081,8 +1071,7 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
if (response.data.auth.nt_status != 0) {
if (error) {
- wbc_status = wbc_create_error_info(NULL,
- &response,
+ wbc_status = wbc_create_error_info(&response,
error);
BAIL_ON_WBC_ERROR(wbc_status);
}
@@ -1093,15 +1082,13 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
BAIL_ON_WBC_ERROR(wbc_status);
if (info) {
- wbc_status = wbc_create_logon_info(NULL,
- &response,
+ wbc_status = wbc_create_logon_info(&response,
info);
BAIL_ON_WBC_ERROR(wbc_status);
}
if (policy) {
- wbc_status = wbc_create_password_policy_info(NULL,
- &response,
+ wbc_status = wbc_create_password_policy_info(&response,
policy);
BAIL_ON_WBC_ERROR(wbc_status);
}
diff --git a/source3/client/client.c b/source3/client/client.c
index f177129..1ceb3ab 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3376,9 +3376,12 @@ static int cmd_volume(void)
fstring volname;
uint32 serial_num;
time_t create_date;
+ NTSTATUS status;
- if (!cli_get_fs_volume_info(cli, volname, &serial_num, &create_date)) {
- d_printf("Errr %s getting volume info\n",cli_errstr(cli));
+ status = cli_get_fs_volume_info(cli, volname, &serial_num,
+ &create_date);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("Error %s getting volume info\n", nt_errstr(status));
return 1;
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 177c333..0db536d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2708,8 +2708,8 @@ struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
struct cli_state *cli);
NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
-bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
-bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
+NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
+ uint32 *pserial_number, time_t *pdate);
bool cli_get_fs_full_size_info(struct cli_state *cli,
uint64_t *total_allocation_units,
uint64_t *caller_allocation_units,
diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c
index 38382e4..b3c9d5f 100644
--- a/source3/libsmb/clifsinfo.c
+++ b/source3/libsmb/clifsinfo.c
@@ -3,17 +3,17 @@
FS info functions
Copyright (C) Stefan (metze) Metzmacher 2003
Copyright (C) Jeremy Allison 2007
-
+
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/>.
*/
@@ -348,105 +348,34 @@ fail:
return status;
}
-bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number)
-{
- bool ret = False;
- uint16 setup;
- char param[2];
- char *rparam=NULL, *rdata=NULL;
- unsigned int rparam_count=0, rdata_count=0;
- unsigned char nlen;
-
- setup = TRANSACT2_QFSINFO;
-
- SSVAL(param,0,SMB_INFO_VOLUME);
-
- if (!cli_send_trans(cli, SMBtrans2,
- NULL,
- 0, 0,
- &setup, 1, 0,
- param, 2, 0,
- NULL, 0, 560)) {
- goto cleanup;
- }
-
- if (!cli_receive_trans(cli, SMBtrans2,
- &rparam, &rparam_count,
- &rdata, &rdata_count)) {
- goto cleanup;
- }
-
- if (cli_is_error(cli)) {
- ret = False;
- goto cleanup;
- } else {
- ret = True;
- }
-
- if (rdata_count < 5) {
- goto cleanup;
- }
-
- if (pserial_number) {
- *pserial_number = IVAL(rdata,0);
- }
- nlen = CVAL(rdata,l2_vol_cch);
- clistr_pull(cli->inbuf, volume_name, rdata + l2_vol_szVolLabel,
- sizeof(fstring), nlen, STR_NOALIGN);
-
- /* todo: but not yet needed
- * return the other stuff
- */
-
-cleanup:
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
-
- return ret;
-}
-
-bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate)
+NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
+ uint32 *pserial_number, time_t *pdate)
{
- bool ret = False;
- uint16 setup;
- char param[2];
- char *rparam=NULL, *rdata=NULL;
- unsigned int rparam_count=0, rdata_count=0;
+ NTSTATUS status;
+ uint16 setup[1];
+ uint8_t param[2];
+ uint8_t *rdata;
+ uint32_t rdata_count;
unsigned int nlen;
- setup = TRANSACT2_QFSINFO;
-
+ SSVAL(setup, 0, TRANSACT2_QFSINFO);
SSVAL(param,0,SMB_QUERY_FS_VOLUME_INFO);
- if (!cli_send_trans(cli, SMBtrans2,
- NULL,
- 0, 0,
- &setup, 1, 0,
- param, 2, 0,
- NULL, 0, 560)) {
- goto cleanup;
- }
-
- if (!cli_receive_trans(cli, SMBtrans2,
- &rparam, &rparam_count,
- &rdata, &rdata_count)) {
- goto cleanup;
- }
-
- if (cli_is_error(cli)) {
- ret = False;
- goto cleanup;
- } else {
- ret = True;
- }
-
- if (rdata_count < 19) {
- goto cleanup;
+ status = cli_trans(talloc_tos(), cli, SMBtrans2,
+ NULL, 0, 0, 0,
+ setup, 1, 0,
+ param, 2, 0,
+ NULL, 0, 560,
+ NULL, 0, NULL,
+ NULL, 0, NULL,
+ &rdata, 10, &rdata_count);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
if (pdate) {
struct timespec ts;
- ts = interpret_long_date(rdata);
+ ts = interpret_long_date((char *)rdata);
*pdate = ts.tv_sec;
}
if (pserial_number) {
@@ -460,11 +389,8 @@ bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *
* return the other stuff
*/
-cleanup:
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
-
- return ret;
+ TALLOC_FREE(rdata);
+ return NT_STATUS_OK;
}
bool cli_get_fs_full_size_info(struct cli_state *cli,
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index 9aff4b0..6589a61 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -148,9 +148,9 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
key = regkey->key;
talloc_set_destructor(key, regkey_destructor);
-
+
/* initialization */
-
+
key->type = REG_KEY_GENERIC;
if (name[0] == '\0') {
@@ -182,7 +182,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
if( StrnCaseCmp(key->name, KEY_HKPD, strlen(KEY_HKPD)) == 0 )
key->type = REG_KEY_HKPD;
-
+
/* Look up the table of registry I/O operations */
if ( !(key->ops = reghook_cache_find( key->name )) ) {
@@ -215,7 +215,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
*pregkey = regkey;
result = WERR_OK;
-
+
done:
if ( !W_ERROR_IS_OK(result) ) {
TALLOC_FREE(regkey);
diff --git a/source3/registry/reg_backend_printing.c b/source3/registry/reg_backend_printing.c
index 90ccc33..278ad4f 100644
--- a/source3/registry/reg_backend_printing.c
+++ b/source3/registry/reg_backend_printing.c
@@ -255,17 +255,17 @@ static int key_printers_fetch_keys( const char *key, struct regsubkey_ctr *subke
}
num_subkeys = get_printer_subkeys( printer->info_2->data, printerdatakey?printerdatakey:"", &subkey_names );
-
+
for ( i=0; i<num_subkeys; i++ )
regsubkey_ctr_addkey( subkeys, subkey_names[i] );
-
+
free_a_printer( &printer, 2 );
-
+
/* no other subkeys below here */
done:
SAFE_FREE( subkey_names );
-
+
return num_subkeys;
}
@@ -281,17 +281,17 @@ static bool add_printers_by_registry( struct regsubkey_ctr *subkeys )
char *printername;
NT_PRINTER_INFO_LEVEL_2 info2;
NT_PRINTER_INFO_LEVEL printer;
-
+
ZERO_STRUCT( info2 );
printer.info_2 = &info2;
-
+
num_keys = regsubkey_ctr_numkeys( subkeys );
-
+
become_root();
for ( i=0; i<num_keys; i++ ) {
printername = regsubkey_ctr_specific_key( subkeys, i );
snum = find_service( printername );
-
+
/* just verify a valied snum for now */
if ( snum == -1 ) {
fstrcpy( info2.printername, printername );
@@ -318,34 +318,34 @@ static bool key_printers_store_keys( const char *key, struct regsubkey_ctr *subk
int i, num_subkeys, num_existing_keys;
char *subkeyname;
fstring *existing_subkeys = NULL;
-
+
printers_key = strip_printers_prefix( key );
-
+
if ( !printers_key ) {
/* have to deal with some new or deleted printer */
return add_printers_by_registry( subkeys );
}
-
+
if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
return False;
}
-
+
/* lookup the printer */
-
+
if ( !W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, printername)) ) {
DEBUG(0,("key_printers_store_keys: Tried to store subkey for bad printername %s\n",
printername));
return False;
}
-
+
/* get the top level printer keys */
-
+
num_existing_keys = get_printer_subkeys( printer->info_2->data, "", &existing_subkeys );
-
+
for ( i=0; i<num_existing_keys; i++ ) {
-
+
/* remove the key if it has been deleted */
-
+
if ( !regsubkey_ctr_key_exists( subkeys, existing_subkeys[i] ) ) {
DEBUG(5,("key_printers_store_keys: deleting key %s\n",
existing_subkeys[i]));
@@ -366,13 +366,13 @@ static bool key_printers_store_keys( const char *key, struct regsubkey_ctr *subk
}
}
}
-
+
/* write back to disk */
-
+
mod_a_printer( printer, 2 );
-
+
/* cleanup */
-
+
free_a_printer( &printer, 2 );
SAFE_FREE( existing_subkeys );
@@ -388,12 +388,12 @@ static void fill_in_printer_values(NT_PRINTER_INFO_LEVEL_2 *info2, struct regval
struct spoolss_DeviceMode *devmode;
char *p;
--
Samba Shared Repository
More information about the samba-cvs
mailing list