Fix uid/euid usage
authorMichael Andres <ma@suse.de>
Fri, 12 Apr 2013 15:39:10 +0000 (17:39 +0200)
committerMichael Andres <ma@suse.de>
Tue, 16 Apr 2013 10:57:15 +0000 (12:57 +0200)
zypp/PathInfo.cc
zypp/media/CurlConfig.cc
zypp/media/MediaHandler.cc

index e79e12b..3b9e570 100644 (file)
@@ -226,9 +226,9 @@ namespace zypp
     {
       if ( !isExist() )
         return 0;
-      if ( owner() == getuid() ) {
+      if ( owner() == geteuid() ) {
         return( uperm()/0100 );
-      } else if ( group() == getgid() ) {
+      } else if ( group() == getegid() ) {
         return( gperm()/010 );
       }
       return operm();
index 1c59d1a..5f0e2ad 100644 (file)
@@ -38,8 +38,8 @@ namespace zypp
     PathInfo h_info(curlrcFile.dirname(), PathInfo::LSTAT);
     PathInfo c_info(curlrcFile,           PathInfo::LSTAT);
 
-    if( h_info.isDir()  && h_info.owner() == getuid() &&
-        c_info.isFile() && c_info.owner() == getuid())
+    if( h_info.isDir()  && h_info.userMayRX() &&
+        c_info.isFile() && c_info.userMayR() )
     {
       MIL << "Going to parse " << curlrcFile << endl;
     }
index 622473c..d634c73 100644 (file)
@@ -385,7 +385,7 @@ MediaHandler::createAttachPoint(const Pathname &attach_root) const
   }
 
   PathInfo adir( attach_root );
-  if( !adir.isDir() || (getuid() != 0 && !adir.userMayRWX())) {
+  if( !adir.isDir() || (geteuid() != 0 && !adir.userMayRWX())) {
     DBG << "Create attach point: attach root is not a writable directory: '"
         << attach_root << "'" << std::endl;
     return apoint;