Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meta-elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
meta-elphel393
Commits
e986ef6f
Commit
e986ef6f
authored
May 28, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing bug related to the new security features in Git. Some requests to versions were made as root
parent
24b85cf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
elphel-misc-functions.bbclass
classes/elphel-misc-functions.bbclass
+19
-2
No files found.
classes/elphel-misc-functions.bbclass
View file @
e986ef6f
...
...
@@ -23,12 +23,29 @@ def version_update(path,file,evr):
return res
def revision_update(path,file):
import subprocess
import subprocess, os# , pwd for some reasons pwd.getpwall() show some 3-user default, so read and parse etc/passwd
pef = None # , preexec_fn=pefuid
if (os.getuid() == 0):
uname = os.getlogin()
with open("/etc/passwd") as f:
for line in f:
line = line.strip()
a = line.split(':')
if a[0] == uname:
pef = preexec_fn=demote(int(a[3]),int(a[2]));
break
cmd = "cd "+path+"; git rev-list --count $(git log -1 --pretty=format:\"%H\" "+file+")..HEAD"
try:
res = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
res = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True
, preexec_fn=pef
)
except subprocess.CalledProcessError as e:
res = "error_"+e.returncode
res = str(int(res))
res = res.strip(' \t\n\r')
return res
def demote(user_uid, user_gid):
import os
def result():
os.setgid(user_gid)
os.setuid(user_uid)
return result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment