[PATCH] umask audit

Martin Pool mbp at samba.org
Fri Feb 7 04:37:14 GMT 2003


Following on from the bug in winbindd this morning I did a quick grep
for umask.

In HEAD/client/client.c main(), there is a pair of calls to umask.  It
looks to me like they're trying to retrieve the current umask without
changing it.  However, the retrieved value is never used.  (Did I miss
something?)  Therefore I think the calls ought to be deleted.

--- client.c.~1.230.~	2003-01-13 15:46:34.000000000 +1100
+++ client.c	2003-02-07 15:33:13.000000000 +1100
@@ -73,8 +73,6 @@ extern BOOL tar_reset;
 /* clitar bits end */
  
 
-static mode_t myumask = 0755;
-
 static BOOL prompt = True;
 
 static int printmode = 1;
@@ -2756,8 +2754,6 @@ static void remember_query_host(const ch
 	pstrcpy(workgroup,lp_workgroup());
 
 	load_interfaces();
-	myumask = umask(0);
-	umask(myumask);
 
 	if (getenv("USER")) {
 		pstrcpy(username,getenv("USER"));



This code was apparently copied and pasted into rpctorture.c and is
also redundant there.


--- rpctorture.c.~1.12.~	2002-02-04 11:53:12.000000000 +1100
+++ rpctorture.c	2003-02-07 15:35:08.000000000 +1100
@@ -225,7 +225,6 @@ enum client_action
 	pstring term_code;
 	BOOL got_pass = False;
 	char *cmd_str="";
-	mode_t myumask = 0755;
 	enum client_action cli_action = CLIENT_NONE;
 	int nprocs = 1;
 	int numops = 100;
@@ -290,9 +289,6 @@ enum client_action
 
 	setup_logging(pname, True);
 
-	myumask = umask(0);
-	umask(myumask);
-
 	if (!get_myname(global_myname))
 	{
 		fprintf(stderr, "Failed to get my hostname.\n");



-- 
Martin 


More information about the samba-technical mailing list