Skip to content

Commit

Permalink
Release ts-warp-1.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mezantrop committed Sep 7, 2024
1 parent c618de2 commit 2320156
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

* **2024.09.04 Current**
* **2024.09.07 ts-warp-1.5.6, gui-warp-1.0.25 (gui-warp-v1.0.32-mac), ns-warp-1.0.7****
* `GUI-Warp.app`: Better handling of `starter`, `starter.c` updated to v1.3
* `GUI-Warp.app`: `starter.c` updated to v1.2
* `inifile.c`: `proxy_server` variable parsing. Thanks <[email protected]> for the bug-hunting and testing
* `GUI-Warp.app`: `starter.c` to handle environment variables
Expand Down
22 changes: 21 additions & 1 deletion gui/ports/macOS/gui-warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, width=800, height=560,

self.password = ''

self.version = 'v1.0.31-mac'
self.version = 'v1.0.32-mac'
self.width = width
self.height = height

Expand Down Expand Up @@ -357,12 +357,16 @@ def saveini(self, t_widget, filename):
Save INI-file
"""

uid = os.getuid()
gid = os.getgid()
with open(filename, 'w', encoding='utf8') as f:
f.write(t_widget.get('1.0', tk.END)[:-1]) # Strip extra newline
os.chown(filename, uid, gid)

# Rebuild ts-warp_pf.conf when saving the INI-file
with open(fwfile, 'w', encoding='utf8') as outfw:
subprocess.run(['./ts-warp_autofw.sh', prefix], stdout=outfw, check=False)
os.chown(fwfile, uid, gid)

# ---------------------------------------------------------------------------------------------------------------- #
def pauselog(self, btn, txt, filename):
Expand Down Expand Up @@ -432,7 +436,10 @@ def run_script(self, command):
stdin=subprocess.PIPE)
gwp.communicate(self.password)
else:
uid = os.getuid()
os.setuid(0)
subprocess.Popen([runcmd, command, prefix, '-v', self.cmb_lvl.get(), self.tsw_opts.get()])
os.setreuid(uid, 0)

# ---------------------------------------------------------------------------------------------------------------- #
def ask_password(self):
Expand Down Expand Up @@ -561,14 +568,27 @@ def dedupch(s, c='/'):
os.makedirs(prefix + 'etc/')
if not os.path.exists(prefix + 'var/log/'):
os.makedirs(prefix + 'var/log/')
if not os.path.exists(logfile):
open(logfile, 'a').close()
if not os.path.exists(prefix + 'var/run/'):
os.makedirs(prefix + 'var/run/')
if not os.path.exists(pidfile):
open(pidfile, 'a').close()
if not os.path.exists(prefix + 'var/spool/ts-warp/'):
os.makedirs(prefix + 'var/spool/ts-warp/')

for f in (prefix, prefix + '/etc', prefix + '/var', prefix + 'var/log', prefix + 'var/run',
prefix + 'var/spool', prefix + 'var/spool/ts-warp', prefix + 'etc/gui-warp.ini',
runcmd, inifile, fwfile, logfile, pidfile, actfile):
try:
os.chown(f, os.getuid(), os.getgid())
except:
pass

if not os.path.exists(fwfile):
with open(fwfile, 'w', encoding='utf8') as outfw:
subprocess.run(['./ts-warp_autofw.sh', prefix], stdout=outfw, check=False)
os.chown(fwfile, os.getuid(), os.getgid())
if not os.path.exists(logfile):
open(logfile, 'a', encoding='utf8').close()

Expand Down
17 changes: 8 additions & 9 deletions gui/ports/macOS/starter.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
this stuff is worth it, you can buy me a beer in return Mikhail Zakharov
*/

/* -------------------------------------------------------------------------- */

/*
2024.08.29 v1.0 Initial release
2024.09.01 v1.1 Handle environment variables
2024.09.04 v1.2 Preserve original starter name for the started app
2024.09.04 v1.2 Pass original starter name as the started app name
2024.09.06 v1.3 Pass app args; allow app handling UID/EUID; Drop environ
*/


Expand All @@ -28,23 +31,19 @@

/* -------------------------------------------------------------------------- */
int main(int argc, char *argv[]) {
extern char** environ;
char buf[DIRBUFSZ];

if (argc > 2 || (argc == 2 && !strncmp(argv[1], "-h", 2))) {
fprintf(stdout,
"Run a program (default name: app) in the same directory\n\n"
"Usage: %s [program]\n", basename(argv[0]));
if (argc == 2 && !strncmp(argv[1], "-h", 2)) {
fprintf(stdout, "Run a program named app from the same directory\n");
return 0;
}

setuid(geteuid());

if (argv[0][0] == '/')
strncpy(buf, dirname(argv[0]), DIRBUFSZ);
else
getcwd(buf, DIRBUFSZ);
strncat(buf, APP_NAME, DIRBUFSZ);
argv[0] = basename(argv[0]);

return execle(buf, basename(argv[0]), 0, environ);
return execv(buf, argv);
}
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define PROG_NAME_SHORT "TSW"
#define PROG_VERSION_MAJOR "1"
#define PROG_VERSION_MINOR "5"
#define PROG_VERSION_BUILD "5"
#define PROG_VERSION_BUILD "6"
#define PROG_VERSION PROG_VERSION_MAJOR "." PROG_VERSION_MINOR "." PROG_VERSION_BUILD
#define PROG_NAME_FULL PROG_NAME " " PROG_VERSION
#define PROG_NAME_CODE PROG_NAME_SHORT PROG_VERSION

0 comments on commit 2320156

Please sign in to comment.