1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3: Fix some nonempty blank lines

This commit is contained in:
Volker Lendecke 2009-11-21 22:52:12 +01:00
parent 384f303c2c
commit e28545e854
9 changed files with 468 additions and 568 deletions

View File

@ -179,7 +179,6 @@ SMBC_get_cached_server(SMBCCTX * context,
continue;
}
return srv->server;
}
}

View File

@ -59,7 +59,6 @@ add_fd(SMBCFILE * file)
if (f) {
/* We found one that's available */
DLIST_REMOVE(smbc_compat_fd_avail, f);
} else {
/*
* None were available, so allocate one. Keep the number of

View File

@ -52,19 +52,15 @@ SMBC_open_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
return NULL;
}
if (!fname) {
errno = EINVAL;
TALLOC_FREE(frame);
return NULL;
}
if (SMBC_parse_path(frame,
@ -93,7 +89,6 @@ SMBC_open_ctx(SMBCCTX *context,
srv = SMBC_server(frame, context, True,
server, share, &workgroup, &user, &password);
if (!srv) {
if (errno == EPERM) errno = EACCES;
TALLOC_FREE(frame);
@ -106,7 +101,6 @@ SMBC_open_ctx(SMBCCTX *context,
status = NT_STATUS_OBJECT_PATH_INVALID;
} else {
file = SMB_MALLOC_P(SMBCFILE);
if (!file) {
errno = ENOMEM;
TALLOC_FREE(frame);
@ -137,7 +131,6 @@ SMBC_open_ctx(SMBCCTX *context,
errno = SMBC_errno(context, targetcli);
TALLOC_FREE(frame);
return NULL;
}
/* Fill in file struct */
@ -183,7 +176,6 @@ SMBC_open_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return file;
}
/* Check if opendir needed ... */
@ -196,13 +188,11 @@ SMBC_open_ctx(SMBCCTX *context,
if (!file) errno = eno;
TALLOC_FREE(frame);
return file;
}
errno = EINVAL; /* FIXME, correct errno ? */
TALLOC_FREE(frame);
return NULL;
}
/*
@ -214,12 +204,9 @@ SMBC_creat_ctx(SMBCCTX *context,
const char *path,
mode_t mode)
{
if (!context || !context->internal->initialized) {
errno = EINVAL;
return NULL;
}
return SMBC_open_ctx(context, path,
@ -255,11 +242,9 @@ SMBC_read_ctx(SMBCCTX *context,
off_t offset;
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
DEBUG(4, ("smbc_read(%p, %d)\n", file, (int)count));
@ -268,7 +253,6 @@ SMBC_read_ctx(SMBCCTX *context,
errno = EBADF;
TALLOC_FREE(frame);
return -1;
}
offset = file->offset;
@ -279,7 +263,6 @@ SMBC_read_ctx(SMBCCTX *context,
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>read: parsing %s\n", file->fname);*/
@ -312,11 +295,9 @@ SMBC_read_ctx(SMBCCTX *context,
ret = cli_read(targetcli, file->cli_fd, (char *)buf, offset, count);
if (ret < 0) {
errno = SMBC_errno(context, targetcli);
TALLOC_FREE(frame);
return -1;
}
file->offset += ret;
@ -325,7 +306,6 @@ SMBC_read_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return ret; /* Success, ret bytes of data ... */
}
/*
@ -349,11 +329,9 @@ SMBC_write_ctx(SMBCCTX *context,
/* First check all pointers before dereferencing them */
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
@ -368,7 +346,6 @@ SMBC_write_ctx(SMBCCTX *context,
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
offset = file->offset; /* See "offset" comment in SMBC_read_ctx() */
@ -402,12 +379,10 @@ SMBC_write_ctx(SMBCCTX *context,
ret = cli_write(targetcli, file->cli_fd,
0, (char *)buf, offset, count);
if (ret <= 0) {
errno = SMBC_errno(context, targetcli);
TALLOC_FREE(frame);
return -1;
}
file->offset += ret;
@ -432,7 +407,6 @@ SMBC_close_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
@ -478,7 +452,6 @@ SMBC_close_ctx(SMBCCTX *context,
/*d_printf(">>>close: resolved path as %s\n", targetpath);*/
if (!NT_STATUS_IS_OK(cli_close(targetcli, file->cli_fd))) {
DEBUG(3, ("cli_close failed on %s. purging server.\n",
file->fname));
/* Deallocate slot and remove the server
@ -491,14 +464,12 @@ SMBC_close_ctx(SMBCCTX *context,
smbc_getFunctionRemoveUnusedServer(context)(context, srv);
TALLOC_FREE(frame);
return -1;
}
DLIST_REMOVE(context->internal->files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
TALLOC_FREE(frame);
return 0;
}
@ -525,7 +496,6 @@ SMBC_getatr(SMBCCTX * context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return False;
@ -579,27 +549,21 @@ SMBC_getatr(SMBCCTX * context,
}
if (NT_STATUS_IS_OK(cli_getatr(targetcli, targetpath, mode, size, &write_time))) {
struct timespec w_time_ts;
w_time_ts = convert_time_t_to_timespec(write_time);
if (write_time_ts != NULL) {
*write_time_ts = w_time_ts;
}
if (create_time_ts != NULL) {
*create_time_ts = w_time_ts;
}
if (access_time_ts != NULL) {
*access_time_ts = w_time_ts;
}
if (change_time_ts != NULL) {
*change_time_ts = w_time_ts;
}
srv->no_pathinfo2 = True;
TALLOC_FREE(frame);
return True;
@ -608,7 +572,6 @@ SMBC_getatr(SMBCCTX * context,
errno = EPERM;
TALLOC_FREE(frame);
return False;
}
/*
@ -662,7 +625,6 @@ SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path,
/* Open the file */
if (!NT_STATUS_IS_OK(cli_open(srv->cli, path, O_RDWR, DENY_NONE, &fd))) {
errno = SMBC_errno(context, srv->cli);
TALLOC_FREE(frame);
return -1;
@ -716,37 +678,30 @@ SMBC_lseek_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
}
if (!file->file) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1; /* Can't lseek a dir ... */
}
switch (whence) {
case SEEK_SET:
file->offset = offset;
break;
case SEEK_CUR:
file->offset += offset;
break;
case SEEK_END:
/*d_printf(">>>lseek: parsing %s\n", file->fname);*/
if (SMBC_parse_path(frame,
@ -773,8 +728,8 @@ SMBC_lseek_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>lseek: resolved path as %s\n", targetpath);*/
/*d_printf(">>>lseek: resolved path as %s\n", targetpath);*/
if (!cli_qfileinfo(targetcli, file->cli_fd, NULL,
&size, NULL, NULL, NULL, NULL, NULL))
{
@ -789,16 +744,13 @@ SMBC_lseek_ctx(SMBCCTX *context,
}
file->offset = size + offset;
break;
default:
errno = EINVAL;
break;
}
TALLOC_FREE(frame);
return file->offset;
}
@ -822,7 +774,6 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
@ -875,5 +826,4 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return 0;
}

View File

@ -388,7 +388,6 @@ SMBC_parse_path(TALLOC_CTX *ctx,
string_replace(*pp_path, '/', '\\');
decoding:
(void) urldecode_talloc(ctx, pp_path, *pp_path);
(void) urldecode_talloc(ctx, pp_server, *pp_server);
(void) urldecode_talloc(ctx, pp_share, *pp_share);
@ -407,7 +406,6 @@ decoding:
workgroup,
*pp_user,
*pp_password);
return 0;
}

View File

@ -43,7 +43,6 @@ SMBC_open_print_job_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return NULL;
@ -101,19 +100,15 @@ SMBC_print_file_ctx(SMBCCTX *c_file,
if (!c_file || !c_file->internal->initialized ||
!c_print || !c_print->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
if (!fname && !printq) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
/* Try to open the file for reading ... */
@ -129,30 +124,24 @@ SMBC_print_file_ctx(SMBCCTX *c_file,
if ((long)(fid2 = smbc_getFunctionOpenPrintJob(c_print)(c_print,
printq)) < 0) {
saverr = errno; /* Save errno */
smbc_getFunctionClose(c_file)(c_file, fid1);
errno = saverr;
TALLOC_FREE(frame);
return -1;
}
while ((bytes = smbc_getFunctionRead(c_file)(c_file, fid1,
buf, sizeof(buf))) > 0) {
tot_bytes += bytes;
if ((smbc_getFunctionWrite(c_print)(c_print, fid2,
buf, bytes)) < 0) {
saverr = errno;
smbc_getFunctionClose(c_file)(c_file, fid1);
smbc_getFunctionClose(c_print)(c_print, fid2);
errno = saverr;
}
}
saverr = errno;
@ -161,16 +150,13 @@ SMBC_print_file_ctx(SMBCCTX *c_file,
smbc_getFunctionClose(c_print)(c_print, fid2);
if (bytes < 0) {
errno = saverr;
TALLOC_FREE(frame);
return -1;
}
TALLOC_FREE(frame);
return tot_bytes;
}
/*
@ -192,7 +178,6 @@ SMBC_list_print_jobs_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
@ -247,7 +232,6 @@ SMBC_list_print_jobs_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return 0;
}
/*
@ -270,7 +254,6 @@ SMBC_unlink_print_job_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
@ -312,25 +295,20 @@ SMBC_unlink_print_job_ctx(SMBCCTX *context,
server, share, &workgroup, &user, &password);
if (!srv) {
TALLOC_FREE(frame);
return -1; /* errno set by SMBC_server */
}
if ((err = cli_printjob_del(srv->cli, id)) != 0) {
if (err < 0)
errno = SMBC_errno(context, srv->cli);
else if (err == ERRnosuchprintjob)
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
TALLOC_FREE(frame);
return 0;
}

View File

@ -36,15 +36,12 @@ generate_inode(SMBCCTX *context,
const char *name)
{
if (!context || !context->internal->initialized) {
errno = EINVAL;
return -1;
}
if (!*name) return 2; /* FIXME, why 2 ??? */
return (ino_t)str_checksum(name);
}
/*
@ -99,7 +96,6 @@ setup_stat(SMBCCTX *context,
TALLOC_FREE(frame);
return True; /* FIXME: Is this needed ? */
}
/*
@ -127,7 +123,6 @@ SMBC_stat_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
return -1;
@ -167,7 +162,6 @@ SMBC_stat_ctx(SMBCCTX *context,
srv = SMBC_server(frame, context, True,
server, share, &workgroup, &user, &password);
if (!srv) {
TALLOC_FREE(frame);
return -1; /* errno set by SMBC_server */
@ -195,7 +189,6 @@ SMBC_stat_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return 0;
}
/*
@ -223,7 +216,6 @@ SMBC_fstat_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
@ -273,17 +265,14 @@ SMBC_fstat_ctx(SMBCCTX *context,
&write_time_ts,
&change_time_ts,
&ino)) {
time_t change_time, access_time, write_time;
if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd, &mode, &size,
&change_time, &access_time, &write_time))) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
change_time_ts = convert_time_t_to_timespec(change_time);
access_time_ts = convert_time_t_to_timespec(access_time);
write_time_ts = convert_time_t_to_timespec(write_time);
@ -300,7 +289,6 @@ SMBC_fstat_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return 0;
}
@ -369,7 +357,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
uint32 fs_attrs = 0;
struct cli_state *cli = file->srv->cli;
/* Initialize all fields (at least until we actually use them) */
memset(st, 0, sizeof(*st));

View File

@ -38,13 +38,11 @@ find_lsa_pipe_hnd(struct cli_state *ipc_cli)
for (pipe_hnd = ipc_cli->pipe_list;
pipe_hnd;
pipe_hnd = pipe_hnd->next) {
if (ndr_syntax_id_equal(&pipe_hnd->abstract_syntax,
&ndr_table_lsarpc.syntax_id)) {
return pipe_hnd;
}
}
return NULL;
}
@ -246,7 +244,6 @@ convert_string_to_sid(struct cli_state *ipc_cli,
sid_copy(sid, &sids[0]);
done:
TALLOC_FREE(ctx);
return result;
}
@ -293,7 +290,6 @@ parse_ace(struct cli_state *ipc_cli,
{ "", 0 },
};
ZERO_STRUCTP(ace);
p = strchr_m(str,':');
if (!p) {
@ -542,7 +538,6 @@ sec_desc_parse(TALLOC_CTX *ctx,
done:
SAFE_FREE(group_sid);
SAFE_FREE(owner_sid);
return ret;
}
@ -812,7 +807,6 @@ cacl_get(SMBCCTX *context,
/* Look for exclusions from "all" requests */
if (all || all_nt || all_dos) {
/* Exclusions are delimited by '!' */
for (;
pExclude != NULL;
@ -1165,7 +1159,6 @@ cacl_get(SMBCCTX *context,
errno = SMBC_errno(context, srv->cli);
return -1;
}
create_time = convert_timespec_to_time_t(create_time_ts);
@ -1533,7 +1526,6 @@ cacl_set(SMBCCTX *context,
}
sd = sec_desc_parse(ctx, ipc_cli, pol, numeric, the_acl);
if (!sd) {
errno = EINVAL;
return -1;
@ -1720,7 +1712,6 @@ SMBC_setxattr_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
return -1;
@ -2015,7 +2006,6 @@ SMBC_getxattr_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
return -1;
@ -2151,7 +2141,6 @@ SMBC_removexattr_ctx(SMBCCTX *context,
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
return -1;