コード例 #1
0
ファイル: ui.py プロジェクト: guitao/hg-stable
    def _trusted(self, fp, f):
        st = util.fstat(fp)
        if util.isowner(st):
            return True

        tusers, tgroups = self._trustusers, self._trustgroups
        if "*" in tusers or "*" in tgroups:
            return True

        user = util.username(st.st_uid)
        group = util.groupname(st.st_gid)
        if user in tusers or group in tgroups or user == util.username():
            return True

        if self._reportuntrusted:
            self.warn(_("not trusting file %s from untrusted " "user %s, group %s\n") % (f, user, group))
        return False
コード例 #2
0
    def _trusted(self, fp, f):
        st = util.fstat(fp)
        if util.isowner(st):
            return True

        tusers, tgroups = self._trustusers, self._trustgroups
        if '*' in tusers or '*' in tgroups:
            return True

        user = util.username(st.st_uid)
        group = util.groupname(st.st_gid)
        if user in tusers or group in tgroups or user == util.username():
            return True

        if self._reportuntrusted:
            self.warn(_('Not trusting file %s from untrusted '
                        'user %s, group %s\n') % (f, user, group))
        return False
コード例 #3
0
ファイル: ui.py プロジェクト: pombredanne/SmartNotes
 def _is_trusted(self, fp, f, warn=True):
     if not self.check_trusted:
         return True
     st = util.fstat(fp)
     if util.isowner(fp, st):
         return True
     tusers = self.trusted_users
     tgroups = self.trusted_groups
     if not tusers:
         user = util.username()
         if user is not None:
             self.trusted_users[user] = 1
             self.fixconfig(section="trusted")
     if (tusers or tgroups) and "*" not in tusers and "*" not in tgroups:
         user = util.username(st.st_uid)
         group = util.groupname(st.st_gid)
         if user not in tusers and group not in tgroups:
             if warn and self.report_untrusted:
                 self.warn(_("Not trusting file %s from untrusted " "user %s, group %s\n") % (f, user, group))
             return False
     return True
コード例 #4
0
 def _is_trusted(self, fp, f, warn=True):
     if not self.check_trusted:
         return True
     st = util.fstat(fp)
     if util.isowner(fp, st):
         return True
     tusers = self.trusted_users
     tgroups = self.trusted_groups
     if not tusers:
         user = util.username()
         if user is not None:
             self.trusted_users[user] = 1
             self.fixconfig(section='trusted')
     if (tusers or tgroups) and '*' not in tusers and '*' not in tgroups:
         user = util.username(st.st_uid)
         group = util.groupname(st.st_gid)
         if user not in tusers and group not in tgroups:
             if warn and self.report_untrusted:
                 self.warn(_('Not trusting file %s from untrusted '
                             'user %s, group %s\n') % (f, user, group))
             return False
     return True