Public bug reported:

Binary package hint: apt

Description:    Ubuntu 8.10
Release:        8.10


apt:
  Installed: 0.7.14ubuntu6
  Candidate: 0.7.14ubuntu6
  Version table:
 *** 0.7.14ubuntu6 0
        500 http://us.archive.ubuntu.com intrepid/main Packages
        100 /var/lib/dpkg/status


The /etc/cron.daily/apt script (mis)uses 'sudo' to execute commands as the 
local administrator.  It appears to expect an environment where root is allowed 
to use 'sudo' and where users are allowed to use 'sudo' without an assigned 
TTY/PTY.  Since this configuration may not always exist and the script is 
running as root, a cleaner way for the script to run is to make use of 'su'.  
The following patch fixes the script:

--- apt.ORIG       2009-03-09 10:48:18.000000000 -0500
+++ apt 2009-03-09 10:50:05.000000000 -0500
@@ -209,10 +209,10 @@
 
 # set the proxy based on the admin users gconf settings
 admin_user=$(getent group admin|cut -d: -f4|cut -d, -f1)
-if [ -n "$admin_user" ] && [ -x /usr/bin/sudo ] && [ -z "$http_proxy" ] && [ 
-x /usr/bin/gconftool ]; then
-       use=$(sudo -u "$admin_user" gconftool --get 
/system/http_proxy/use_http_proxy)
-       host=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/host)
-       port=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/port)
+if [ -n "$admin_user" ] && [ -x /bin/su ] && [ -z "$http_proxy" ] && [ -x 
/usr/bin/gconftool ]; then
+       use=$(su -l -c 'gconftool --get /system/http_proxy/host' $admin_user)
+       host=$(su -l -c 'gconftool --get /system/http_proxy/host' $admin_user)
+       port=$(su -l -c 'gconftool --get /system/http_proxy/port' $admin_user)
        if [ "$use" = "true" ] && [ -n "$host" ] && [ -n "$port" ]; then
                export http_proxy="http://$host:$port/";
        fi


This should work anywhere that 'su' is installed and is not reliant upon 
specific settings in the 'sudoers' file.

** Affects: apt (Ubuntu)
     Importance: Undecided
         Status: New

-- 
[patch] /etc/cron.daily/apt relies on specific sudo config
https://bugs.launchpad.net/bugs/340017
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to