[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1500: adduser makes a .bash_profile in the invoking user's directory



Here is a better version of my patch, which also supplies the home
directory to adduser.local.

Ian.

--- /usr/sbin/adduser	Mon Jul 10 02:10:53 1995
+++ /usr/local/sbin/adduser	Thu Sep 28 19:31:07 1995
@@ -671,14 +671,14 @@
 		$this_file = $home_dir . "/" . $file;
 		if (-f $this_file) {
 		    open (FILE, "$this_file") || die "open: $!";
-		    open (NEWFILE, ">$file.new") || die "open: $!";
+		    open (NEWFILE, ">$this_file.new") || die "open: $!";
 		    while ($line = <FILE>) {
 			$line =~ s/umask 0([267])\1/umask 00$1/;
 			print NEWFILE $line;
 		    }
 		    close FILE;
 		    close NEWFILE;
-		    rename ("$file.new", "$file") || die "rename: $!";
+		    rename ("$this_file.new", "$this_file") || die "rename: $!";
 		}
 	    }
 	}
@@ -719,6 +719,11 @@
     }
     print "done.\n";
     &clean_up();
+    if (-f "/usr/local/sbin/adduser.local") {
+        exec("/usr/local/sbin/adduser.local",
+             $new_name, $new_uid, $new_gid, $home_dir);
+        die "exec adduser.local: $!";
+    }
     exit 0;
 }


Reply to: