[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-422-g3e65fa5
Jeremy Allison
jra at samba.org
Sat Dec 1 02:14:02 GMT 2007
The branch, v3-2-test has been updated
via 3e65fa5bcf5d1af3983f2e576698eccaad79fcda (commit)
via 4dfe19be1c3a63b8517c6580c9cd363c7271693d (commit)
from 6e27663cb44a79f729fa4366e000c43383f6d1b7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 3e65fa5bcf5d1af3983f2e576698eccaad79fcda
Author: Jeremy Allison <jra at samba.org>
Date: Fri Nov 30 18:02:19 2007 -0800
Ensure we have 2 bytes of zeros as a pad-buffer at the
end of all returned trans/trans2/nttrans client replies.
Not included in a count - for safety purposes.
Jeremy.
commit 4dfe19be1c3a63b8517c6580c9cd363c7271693d
Author: Jeremy Allison <jra at samba.org>
Date: Fri Nov 30 16:45:44 2007 -0800
Whitespace cleanup.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/libsmb/clirap2.c | 410 +++++++++++++++++++++++-----------------------
source/libsmb/clitrans.c | 125 ++++++++++-----
2 files changed, 286 insertions(+), 249 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/libsmb/clirap2.c b/source/libsmb/clirap2.c
index 6be7fb6..f522e13 100644
--- a/source/libsmb/clirap2.c
+++ b/source/libsmb/clirap2.c
@@ -1,20 +1,19 @@
-/*
- Samba Unix/Linux SMB client library
+/*
+ Samba Unix/Linux SMB client library
More client RAP (SMB Remote Procedure Calls) functions
Copyright (C) 2001 Steve French (sfrench at us.ibm.com)
Copyright (C) 2001 Jim McDonough (jmcd at us.ibm.com)
-
-
+
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/>.
*/
@@ -30,8 +29,8 @@
/* supports all RAP command codes since some */
/* are quite obsolete and a few are specific */
/* to a particular network operating system */
-/* */
-/* Although it has largely been replaced */
+/* */
+/* Although it has largely been replaced */
/* for complex remote admistration and management */
/* (of servers) by the relatively newer */
/* DCE/RPC based remote API (which better handles */
@@ -73,9 +72,9 @@
/* WPrintJobEnum (API num 76, level 2) */
/* WPrintJobDel (API num 81) */
/* */
-/*****************************************************/
+/*****************************************************/
-#include "includes.h"
+#include "includes.h"
#define WORDSIZE 2
#define DWORDSIZE 4
@@ -128,9 +127,9 @@
static char *make_header(char *param, uint16 apinum, const char *reqfmt, const char *datafmt)
{
PUTWORD(param,apinum);
- if (reqfmt)
+ if (reqfmt)
PUTSTRING(param,reqfmt,0);
- else
+ else
*param++ = (char) 0;
if (datafmt)
@@ -140,7 +139,6 @@ static char *make_header(char *param, uint16 apinum, const char *reqfmt, const c
return param;
}
-
/****************************************************************************
call a NetGroupDelete - delete user group from remote server
@@ -159,20 +157,20 @@ int cli_NetGroupDelete(struct cli_state *cli, const char *group_name )
+WORDSIZE]; /* reserved word */
/* now send a SMBtrans command with api GroupDel */
- p = make_header(param, RAP_WGroupDel, RAP_NetGroupDel_REQ, NULL);
+ p = make_header(param, RAP_WGroupDel, RAP_NetGroupDel_REQ, NULL);
PUTSTRING(p, group_name, RAP_GROUPNAME_LEN);
PUTWORD(p,0); /* reserved word MBZ on input */
-
- if (cli_api(cli,
+
+ if (cli_api(cli,
param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
NULL, 0, 200, /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
if (res == 0) {
- /* nothing to do */
+ /* nothing to do */
}
else if ((res == 5) || (res == 65)) {
DEBUG(1, ("Access Denied\n"));
@@ -182,15 +180,15 @@ int cli_NetGroupDelete(struct cli_state *cli, const char *group_name )
}
else {
DEBUG(4,("NetGroupDelete res=%d\n", res));
- }
+ }
} else {
res = -1;
DEBUG(4,("NetGroupDelete failed\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
-
+
return res;
}
@@ -212,7 +210,7 @@ int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 * grinfo )
/* offset into data of free format strings. Will be updated */
/* by PUTSTRINGP macro and end up with total data length. */
- int soffset = RAP_GROUPNAME_LEN + 1 + DWORDSIZE;
+ int soffset = RAP_GROUPNAME_LEN + 1 + DWORDSIZE;
char *data;
size_t data_size;
@@ -226,27 +224,27 @@ int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 * grinfo )
}
/* now send a SMBtrans command with api WGroupAdd */
-
+
p = make_header(param, RAP_WGroupAdd,
- RAP_NetGroupAdd_REQ, RAP_GROUP_INFO_L1);
+ RAP_NetGroupAdd_REQ, RAP_GROUP_INFO_L1);
PUTWORD(p, 1); /* info level */
PUTWORD(p, 0); /* reserved word 0 */
-
+
p = data;
PUTSTRINGF(p, grinfo->group_name, RAP_GROUPNAME_LEN);
PUTBYTE(p, 0); /* pad byte 0 */
PUTSTRINGP(p, grinfo->comment, data, soffset);
-
- if (cli_api(cli,
+
+ if (cli_api(cli,
param, sizeof(param), 1024, /* Param, length, maxlen */
data, soffset, sizeof(data), /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
if (res == 0) {
- /* nothing to do */
+ /* nothing to do */
} else if ((res == 5) || (res == 65)) {
DEBUG(1, ("Access Denied\n"));
}
@@ -260,7 +258,7 @@ int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 * grinfo )
res = -1;
DEBUG(4,("NetGroupAdd failed\n"));
}
-
+
SAFE_FREE(data);
SAFE_FREE(rparam);
SAFE_FREE(rdata);
@@ -280,11 +278,11 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char
+WORDSIZE]; /* buffer size */
char *p;
char *rparam = NULL;
- char *rdata = NULL;
+ char *rdata = NULL;
unsigned int rprcnt, rdrcnt;
int res = -1;
-
-
+
+
memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WGroupEnum,
RAP_NetGroupEnum_REQ, RAP_GROUP_INFO_L1);
@@ -298,7 +296,7 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char
&rdata, &rdrcnt)) {
res = GETRES(rparam);
cli->rap_error = res;
- if(cli->rap_error == 234)
+ if(cli->rap_error == 234)
DEBUG(1,("Not all group names were returned (such as those longer than 21 characters)\n"));
else if (cli->rap_error != 0) {
DEBUG(1,("NetGroupEnum gave error %d\n", cli->rap_error));
@@ -322,14 +320,14 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char
GETSTRINGP(p, comment, rdata, converter);
fn(groupname, comment, cli);
- }
+ }
} else {
DEBUG(4,("NetGroupEnum res=%d\n", res));
}
} else {
DEBUG(4,("NetGroupEnum no data returned\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
@@ -347,11 +345,11 @@ int cli_RNetGroupEnum0(struct cli_state *cli,
+WORDSIZE]; /* buffer size */
char *p;
char *rparam = NULL;
- char *rdata = NULL;
+ char *rdata = NULL;
unsigned int rprcnt, rdrcnt;
int res = -1;
-
-
+
+
memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WGroupEnum,
RAP_NetGroupEnum_REQ, RAP_GROUP_INFO_L0);
@@ -367,7 +365,7 @@ int cli_RNetGroupEnum0(struct cli_state *cli,
&rdata, &rdrcnt)) {
res = GETRES(rparam);
cli->rap_error = res;
- if(cli->rap_error == 234)
+ if(cli->rap_error == 234)
DEBUG(1,("Not all group names were returned (such as those longer than 21 characters)\n"));
else if (cli->rap_error != 0) {
DEBUG(1,("NetGroupEnum gave error %d\n", cli->rap_error));
@@ -385,14 +383,14 @@ int cli_RNetGroupEnum0(struct cli_state *cli,
char groupname[RAP_GROUPNAME_LEN];
GETSTRINGF(p, groupname, RAP_GROUPNAME_LEN);
fn(groupname, cli);
- }
+ }
} else {
DEBUG(4,("NetGroupEnum res=%d\n", res));
}
} else {
DEBUG(4,("NetGroupEnum no data returned\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
@@ -417,14 +415,14 @@ int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const ch
PUTSTRING(p,group_name,RAP_GROUPNAME_LEN);
PUTSTRING(p,user_name,RAP_USERNAME_LEN);
- if (cli_api(cli,
+ if (cli_api(cli,
param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
NULL, 0, 200, /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
switch(res) {
case 0:
break;
@@ -451,11 +449,11 @@ int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const ch
res = -1;
DEBUG(4,("NetGroupDelUser failed\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
-
- return res;
+
+ return res;
}
int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name)
@@ -476,14 +474,14 @@ int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const ch
PUTSTRING(p,group_name,RAP_GROUPNAME_LEN);
PUTSTRING(p,user_name,RAP_USERNAME_LEN);
- if (cli_api(cli,
+ if (cli_api(cli,
param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
NULL, 0, 200, /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
switch(res) {
case 0:
break;
@@ -507,10 +505,10 @@ int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const ch
res = -1;
DEBUG(4,("NetGroupAddUser failed\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
-
+
return res;
}
@@ -641,20 +639,20 @@ int cli_NetUserDelete(struct cli_state *cli, const char * user_name )
+WORDSIZE]; /* reserved word */
/* now send a SMBtrans command with api UserDel */
- p = make_header(param, RAP_WUserDel, RAP_NetGroupDel_REQ, NULL);
+ p = make_header(param, RAP_WUserDel, RAP_NetGroupDel_REQ, NULL);
PUTSTRING(p, user_name, RAP_USERNAME_LEN);
PUTWORD(p,0); /* reserved word MBZ on input */
-
- if (cli_api(cli,
+
+ if (cli_api(cli,
param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
NULL, 0, 200, /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
if (res == 0) {
- /* nothing to do */
+ /* nothing to do */
}
else if ((res == 5) || (res == 65)) {
DEBUG(1, ("Access Denied\n"));
@@ -664,15 +662,15 @@ int cli_NetUserDelete(struct cli_state *cli, const char * user_name )
}
else {
DEBUG(4,("NetUserDelete res=%d\n", res));
- }
+ }
} else {
res = -1;
DEBUG(4,("NetUserDelete failed\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
-
+
return res;
}
@@ -681,12 +679,9 @@ int cli_NetUserDelete(struct cli_state *cli, const char * user_name )
****************************************************************************/
int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo )
{
-
-
-
char *rparam = NULL;
char *rdata = NULL;
- char *p;
+ char *p;
unsigned int rdrcnt,rprcnt;
int res;
char param[WORDSIZE /* api number */
@@ -695,7 +690,7 @@ int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo )
+WORDSIZE /* info level */
+WORDSIZE /* buffer length */
+WORDSIZE]; /* reserved */
-
+
char data[1024];
/* offset into data of free format strings. Will be updated */
/* by PUTSTRINGP macro and end up with total data length. */
@@ -732,17 +727,17 @@ int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo )
PUTWORD(p, userinfo->userflags);
PUTSTRINGP(p, userinfo->logon_script, data, soffset);
- if (cli_api(cli,
+ if (cli_api(cli,
param, sizeof(param), 1024, /* Param, length, maxlen */
data, soffset, sizeof(data), /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
if (res == 0) {
- /* nothing to do */
- }
+ /* nothing to do */
+ }
else if ((res == 5) || (res == 65)) {
DEBUG(1, ("Access Denied\n"));
}
@@ -756,7 +751,7 @@ int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo )
res = -1;
DEBUG(4,("NetUserAdd failed\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
@@ -775,10 +770,9 @@ int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char
+WORDSIZE]; /* buffer size */
char *p;
char *rparam = NULL;
- char *rdata = NULL;
+ char *rdata = NULL;
unsigned int rprcnt, rdrcnt;
int res = -1;
-
memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WUserEnum,
@@ -828,7 +822,7 @@ int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char
} else {
DEBUG(4,("NetUserEnum no data returned\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
@@ -846,10 +840,9 @@ int cli_RNetUserEnum0(struct cli_state *cli,
+WORDSIZE]; /* buffer size */
char *p;
char *rparam = NULL;
- char *rdata = NULL;
+ char *rdata = NULL;
unsigned int rprcnt, rdrcnt;
int res = -1;
-
memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WUserEnum,
@@ -887,7 +880,7 @@ int cli_RNetUserEnum0(struct cli_state *cli,
} else {
DEBUG(4,("NetUserEnum no data returned\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
@@ -911,31 +904,31 @@ int cli_NetFileClose(struct cli_state *cli, uint32 file_id )
/* now send a SMBtrans command with api RNetShareEnum */
p = make_header(param, RAP_WFileClose2, RAP_WFileClose2_REQ, NULL);
- PUTDWORD(p, file_id);
-
- if (cli_api(cli,
+ PUTDWORD(p, file_id);
+
+ if (cli_api(cli,
param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
NULL, 0, 200, /* data, length, maxlen */
&rparam, &rprcnt, /* return params, length */
&rdata, &rdrcnt)) /* return data, length */
{
res = GETRES(rparam);
-
+
if (res == 0) {
- /* nothing to do */
+ /* nothing to do */
} else if (res == 2314){
DEBUG(1, ("NetFileClose2 - attempt to close non-existant file open instance\n"));
} else {
DEBUG(4,("NetFileClose2 res=%d\n", res));
- }
+ }
} else {
res = -1;
DEBUG(4,("NetFileClose2 failed\n"));
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
-
+
return res;
}
@@ -959,11 +952,11 @@ int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const c
/* now send a SMBtrans command with api RNetShareEnum */
p = make_header(param, RAP_WFileGetInfo2,
--
Samba Shared Repository
More information about the samba-cvs
mailing list