[Adduser-devel] r219 - in trunk: . debian

Marc Haber zugschlus@costa.debian.org
Fri, 18 Mar 2005 17:42:02 +0100


Author: zugschlus
Date: 2005-03-18 17:41:57 +0100 (Fri, 18 Mar 2005)
New Revision: 219

Modified:
   trunk/adduser
   trunk/debian/changelog
Log:
  * Now handles /etc/skel correctly even if it is not readable for a
    normal user. Thanks to Chapko Dimitrij. (mh) Closes: #299489

Long Description: Moved the actual readlink and the error processing
out of the code part that runs with user privileges only. The readlink
done as user failed if /etc/skel is not readably by that user. The
only operation done with dropped privileges is now the actual link
creation.


Modified: trunk/adduser
===================================================================
--- trunk/adduser	2005-03-18 15:29:30 UTC (rev 218)
+++ trunk/adduser	2005-03-18 16:41:57 UTC (rev 219)
@@ -688,14 +688,19 @@
     my($fromdir, $file, $todir, $newu, $newg, $sgiddir) = @_;
 
     if (-l "$fromdir/$file") {
+	my $target=readlink("$fromdir/$file") or &cleanup("readlink: $!\n");
 	my $curgid="$)";
 	my $curuid="$>";
+	my $error="";
 	$)="$newg";
 	$>="$newu";
-	symlink(readlink("$fromdir/$file"), "$todir/$file")
-	    || &cleanup("symlink: $!\n");
+	symlink("$target", "$todir/$file");
+	$error="$!";
         $>="$curuid";
         $)="$curgid";
+	if( "$error" ne "" ) {
+	    &cleanup("symlink: $!\n");
+	}
 	return;
     }
     elsif (-f "$fromdir/$file") {

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-03-18 15:29:30 UTC (rev 218)
+++ trunk/debian/changelog	2005-03-18 16:41:57 UTC (rev 219)
@@ -5,8 +5,10 @@
     Thanks to Hans Fredrik Nordhaug. (mh) Closes: #298834
   * Re-generate adduser.pot, fix gettext bugs in deluser. Thanks to
     Hans Fredrik Nordhaug. (mh)
+  * Now handles /etc/skel correctly even if it is not readable for a
+    normal user. Thanks to Chapko Dimitrij. (mh) Closes: #299489
 
- -- Marc Haber <mh+debian-packages@zugschlus.de>  Fri, 18 Mar 2005 16:28:42 +0100
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Fri, 18 Mar 2005 16:38:14 +0000
 
 adduser (3.63) unstable; urgency=low