rda-python-setuid 1.0.1__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/PKG-INFO +3 -2
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/pyproject.toml +1 -1
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid/pgstart.py +19 -3
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid/pywrapper.c +11 -13
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/PKG-INFO +3 -2
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/LICENSE +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/MANIFEST.in +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/README.md +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/setup.cfg +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid/__init__.py +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid/pywrapper.py +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/SOURCES.txt +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/dependency_links.txt +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/entry_points.txt +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/requires.txt +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/top_level.txt +0 -0
- {rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/tests/test_setuid.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_setuid
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: RDA Python Package to setuid for program executions as an effective or common user
|
|
5
5
|
Author-email: Zaihua Ji <zji@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-setuid
|
|
@@ -12,5 +12,6 @@ Requires-Python: >=3.7
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: rda_python_common
|
|
15
|
+
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
RDA python package, including a C code wrapper, to execute commandline applications via setuid for effective and common user names.
|
|
@@ -35,10 +35,16 @@ def main():
|
|
|
35
35
|
PgLOG.set_suid(PgLOG.PGLOG['EUID'])
|
|
36
36
|
if PgLOG.PGLOG['CURUID'] != PgLOG.PGLOG['RDAUSER'] and PgLOG.PGLOG['CURUID'] != "zji": permit = 0
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
while argv:
|
|
39
39
|
ms = re.match(r'^-(\w+)$', argv[0])
|
|
40
|
-
if ms:
|
|
41
|
-
|
|
40
|
+
if not ms: break
|
|
41
|
+
argv.pop(0)
|
|
42
|
+
opt = ms.group(1)
|
|
43
|
+
if opt == "bg":
|
|
44
|
+
bckgrd = " &"
|
|
45
|
+
elif opt == "cwd":
|
|
46
|
+
if argv: workdir = argv.pop(0)
|
|
47
|
+
elif opt != "fg":
|
|
42
48
|
display_message(opt)
|
|
43
49
|
|
|
44
50
|
if not (permit and argv):
|
|
@@ -52,7 +58,17 @@ def main():
|
|
|
52
58
|
if not permit:
|
|
53
59
|
print("* You must be '{}' to execute a command as user '{}'.".format(PgLOG.PGLOG['RDAUSER'], euser))
|
|
54
60
|
print("********************************************************************")
|
|
61
|
+
sys.exit(0)
|
|
55
62
|
|
|
63
|
+
cmd = PgLOG.argv_to_string(argv)
|
|
64
|
+
|
|
65
|
+
msg = "{}-{}{}-{}".format(PgLOG.PGLOG['HOSTNAME'], aname, PgLOG.current_datetime(), PgLOG.PGLOG['CURUID'])
|
|
66
|
+
if workdir:
|
|
67
|
+
msg += "-" + workdir
|
|
68
|
+
os.chdir(workdir)
|
|
69
|
+
|
|
70
|
+
PgLOG.pglog("{}: {}".format(msg, cmd), PgLOG.MSGLOG)
|
|
71
|
+
os.system(cmd + bckgrd)
|
|
56
72
|
sys.exit(0)
|
|
57
73
|
|
|
58
74
|
#
|
|
@@ -42,16 +42,11 @@
|
|
|
42
42
|
int is_executable(const char *filename) {
|
|
43
43
|
struct stat sb;
|
|
44
44
|
|
|
45
|
-
if(stat(filename, &sb) == 0) {
|
|
46
|
-
|
|
47
|
-
return 1;
|
|
48
|
-
} else {
|
|
49
|
-
printf("%s: not executable\n", prog);
|
|
50
|
-
}
|
|
45
|
+
if(stat(filename, &sb) == 0 && sb.st_mode & S_IXUSR) {
|
|
46
|
+
return 1;
|
|
51
47
|
} else {
|
|
52
|
-
|
|
48
|
+
return 0;
|
|
53
49
|
}
|
|
54
|
-
return 0;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
52
|
/* main program */
|
|
@@ -59,13 +54,15 @@ int main(int argc, char *argv[]) {
|
|
|
59
54
|
char *name;
|
|
60
55
|
char cname[80], prog[255];
|
|
61
56
|
char file[] = __FILE__;
|
|
57
|
+
char *fpath = dirname(file);
|
|
62
58
|
char pgstart[] = "pgstart";
|
|
59
|
+
char **apntr = argv;
|
|
63
60
|
|
|
64
61
|
name = strrchr(argv[0], '/');
|
|
65
62
|
strcpy(cname, (name == NULL ? argv[0] : ++name));
|
|
66
63
|
|
|
67
64
|
if(strstr(cname, pgstart) == cname) {
|
|
68
|
-
if(argc == 1
|
|
65
|
+
if(argc == 1 || argv[1][0] == '-') {
|
|
69
66
|
strcpy(cname, pgstart);
|
|
70
67
|
} else {
|
|
71
68
|
argv += 1;
|
|
@@ -73,9 +70,10 @@ int main(int argc, char *argv[]) {
|
|
|
73
70
|
strcpy(cname, (name == NULL ? argv[0] : ++name));
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
|
-
sprintf(prog, "%s/%s.py",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
sprintf(prog, "%s/%s.py", fpath, cname);
|
|
74
|
+
if(is_executable(prog) == 0) {
|
|
75
|
+
sprintf(prog, "%s/pgstart.py", fpath);
|
|
76
|
+
argv = apntr;
|
|
80
77
|
}
|
|
78
|
+
execv(prog, argv); /* call Python script */
|
|
81
79
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_setuid
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: RDA Python Package to setuid for program executions as an effective or common user
|
|
5
5
|
Author-email: Zaihua Ji <zji@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-setuid
|
|
@@ -12,5 +12,6 @@ Requires-Python: >=3.7
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: rda_python_common
|
|
15
|
+
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
RDA python package, including a C code wrapper, to execute commandline applications via setuid for effective and common user names.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/requires.txt
RENAMED
|
File without changes
|
{rda_python_setuid-1.0.1 → rda_python_setuid-1.0.3}/src/rda_python_setuid.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|