View | Details | Raw Unified | Return to bug 1186602
Collapse All | Expand All

(-)a/src/main.cc (-11 / +4 lines)
Lines 105-120 int main( int argc, char **argv ) Link Here
105
    std::string sudouser { env::SUDO_USER() };
105
    std::string sudouser { env::SUDO_USER() };
106
    if ( ! sudouser.empty() ) {
106
    if ( ! sudouser.empty() ) {
107
      sudo = true;
107
      sudo = true;
108
      PathInfo su { "/usr/bin/su" };
108
      mode_t mask = 0022;
109
      if ( su.isFile() && su.userMayRX() ) {
109
      mode_t omask = ::umask( mask );
110
	std::string umaskstr { ExternalProgram( { su.asString(), "-c", "umask", "-l", "root" }, ExternalProgram::Discard_Stderr ).receiveLine() };
110
      if ( mask != omask )
111
	if ( zypp::str::regex("^0[0-7]{3}$").matches( umaskstr.c_str() ) ) {
111
	std::cerr << "zypper: adjusting umask " << str::octstring(omask,3) << " of sudo-user " << sudouser << " to " << str::octstring(mask,3) << " for user root." << endl;
112
	  mode_t mask = str::strtonum<mode_t>( umaskstr );
113
	  mode_t omask = ::umask( mask );
114
	  if ( mask != omask )
115
	    std::cerr << "zypper: adjusting umask " << str::octstring(omask,3) << " of sudo-user " << sudouser << " to " << str::octstring(mask,3) << " for user root." << endl;
116
	}
117
      }
118
    }
112
    }
119
  }
113
  }
120
114
121
- 

Return to bug 1186602