From 02eda2e251e6dcb6e0db5cd9c3cbcfa765f3d630 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 17 Nov 2001 03:19:17 +0000 Subject: Tidyups when I was doing the big merge... Jeremy. (This used to be commit 9148bb9eaa67de60c3b0b4709a9c05a840c20c66) --- source3/passdb/secrets.c | 15 ++++++++++----- source3/printing/print_cups.c | 2 +- source3/printing/printfsp.c | 1 + source3/rpc_parse/parse_spoolss.c | 9 ++++++--- source3/smbd/reply.c | 28 ++++++++++++++++------------ source3/smbd/trans2.c | 1 + 6 files changed, 35 insertions(+), 21 deletions(-) (limited to 'source3') diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 69b55b4d8c..86ef024bb0 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -31,7 +31,8 @@ BOOL secrets_init(void) { pstring fname; - if (tdb) return True; + if (tdb) + return True; pstrcpy(fname, lp_private_dir()); pstrcat(fname,"/secrets.tdb"); @@ -51,11 +52,13 @@ BOOL secrets_init(void) void *secrets_fetch(char *key, size_t *size) { TDB_DATA kbuf, dbuf; - if (!tdb) return False; + if (!tdb) + return False; kbuf.dptr = key; kbuf.dsize = strlen(key); dbuf = tdb_fetch(tdb, kbuf); - if (size) *size = dbuf.dsize; + if (size) + *size = dbuf.dsize; return dbuf.dptr; } @@ -64,7 +67,8 @@ void *secrets_fetch(char *key, size_t *size) BOOL secrets_store(char *key, void *data, size_t size) { TDB_DATA kbuf, dbuf; - if (!tdb) return False; + if (!tdb) + return False; kbuf.dptr = key; kbuf.dsize = strlen(key); dbuf.dptr = data; @@ -78,7 +82,8 @@ BOOL secrets_store(char *key, void *data, size_t size) BOOL secrets_delete(char *key) { TDB_DATA kbuf; - if (!tdb) return False; + if (!tdb) + return False; kbuf.dptr = key; kbuf.dsize = strlen(key); return tdb_delete(tdb, kbuf) == 0; diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index a83f5de43c..3ab08de13d 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -1,7 +1,7 @@ /* * Support code for the Common UNIX Printing System ("CUPS") * - * Copyright 1999-2001 by Michael R Sweet + * Copyright 1999-2001 by Michael R Sweet. * * 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 diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index 35700bc868..322deadf0f 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -63,6 +63,7 @@ files_struct *print_fsp_open(connection_struct *conn) fsp->directory_delete_on_close = False; fsp->conn = conn; string_set(&fsp->fsp_name,print_job_fname(jobid)); + fsp->wbmpx_ptr = NULL; fsp->wcp = NULL; conn->vfs_ops.fstat(fsp,fsp->fd, &sbuf); fsp->mode = sbuf.st_mode; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5a13403fee..6404a83d51 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4711,7 +4711,8 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) int n = 0; char *src; - if (buf5==NULL) return False; + if (buf5==NULL) + return False; src = (char *)buf5->buffer; *ar = NULL; @@ -4720,8 +4721,10 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) rpcstr_pull(f, src, sizeof(f)-1, -1, 0); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); - if (!tar) return False; - else *ar = tar; + if (!tar) + return False; + else + *ar = tar; fstrcpy((*ar)[n], f); n++; } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index dce5873ba8..1412905cdf 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1164,10 +1164,8 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, /* close fd from smb_mkstemp() */ close(tmpfd); - if (!fsp) - { - if((errno == ENOENT) && bad_path) - { + if (!fsp) { + if((errno == ENOENT) && bad_path) { unix_ERR_class = ERRDOS; unix_ERR_code = ERRbadpath; } @@ -1208,28 +1206,33 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, return(outsize); } - /******************************************************************* -check if a user is allowed to delete a file + Check if a user is allowed to delete a file. ********************************************************************/ + static NTSTATUS can_delete(char *fname,connection_struct *conn, int dirtype) { SMB_STRUCT_STAT sbuf; int fmode; - if (!CAN_WRITE(conn)) return NT_STATUS_MEDIA_WRITE_PROTECTED; + if (!CAN_WRITE(conn)) + return NT_STATUS_MEDIA_WRITE_PROTECTED; - if (conn->vfs_ops.lstat(conn,fname,&sbuf) != 0) return NT_STATUS_OBJECT_NAME_NOT_FOUND; + if (conn->vfs_ops.lstat(conn,fname,&sbuf) != 0) + return NT_STATUS_OBJECT_NAME_NOT_FOUND; fmode = dos_mode(conn,fname,&sbuf); - if (fmode & aDIR) return NT_STATUS_FILE_IS_A_DIRECTORY; + if (fmode & aDIR) + return NT_STATUS_FILE_IS_A_DIRECTORY; if (!lp_delete_readonly(SNUM(conn))) { - if (fmode & aRONLY) return NT_STATUS_CANNOT_DELETE; + if (fmode & aRONLY) + return NT_STATUS_CANNOT_DELETE; } if ((fmode & ~dirtype) & (aHIDDEN | aSYSTEM)) return NT_STATUS_CANNOT_DELETE; - if (!check_file_sharing(conn,fname,False)) return NT_STATUS_SHARING_VIOLATION; + if (!check_file_sharing(conn,fname,False)) + return NT_STATUS_SHARING_VIOLATION; return NT_STATUS_OK; } @@ -2685,7 +2688,8 @@ int reply_mkdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, srvstr_pull(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), -1, STR_TERMINATE); status = mkdir_internal(conn, directory); - if (!NT_STATUS_IS_OK(status)) return ERROR_NT(status); + if (!NT_STATUS_IS_OK(status)) + return ERROR_NT(status); outsize = set_message(outbuf,0,0,True); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index bf0be4c111..404d88260e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1913,6 +1913,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn, break; } + case SMB_FILE_END_OF_FILE_INFORMATION: case SMB_SET_FILE_END_OF_FILE_INFO: { size = IVAL(pdata,0); -- cgit