Commit df4aea04 authored by Ilya Mashkin's avatar Ilya Mashkin Committed by Girar Builder pender robot

3.8.9-alt1

- 3.8.9 (Closes: #25694)
parent 36a16f19
Name: shc Name: shc
Version: 3.8.6 Version: 3.8.9
Release: alt1 Release: alt1
Summary: Generic shell script compiler Summary: Generic shell script compiler
License: GPL License: GPLv2
Group: Development/Other Group: Development/Other
URL: http://www.datsi.fi.upm.es/~frosal/ Url: http://www.datsi.fi.upm.es/~frosal/
Packager: Ilya Mashkin <oddity@altlinux.ru> Packager: Ilya Mashkin <oddity@altlinux.ru>
Source0: %name-%version.tgz Source0: %name-%version.tgz
...@@ -20,15 +20,19 @@ generated source code is then compiled and linked to produce a ...@@ -20,15 +20,19 @@ generated source code is then compiled and linked to produce a
stripped binary executable. Use with care. stripped binary executable. Use with care.
%prep %prep
%setup -q -n %name-%version %setup -n %name-%version
%patch0 #patch0
%build %build
mv shc-3.8.9.c shc.c
%make %make
%install %install
%__mkdir_p $RPM_BUILD_ROOT{%_bindir,%_man1dir} %__mkdir_p $RPM_BUILD_ROOT{%_bindir,%_man1dir}
%makeinstall #make_install
install -c -s %name %buildroot%_bindir
install -c -m 644 %name.1 %buildroot%_man1dir
%files %files
%_bindir/* %_bindir/*
...@@ -36,6 +40,9 @@ stripped binary executable. Use with care. ...@@ -36,6 +40,9 @@ stripped binary executable. Use with care.
%_mandir/man?/* %_mandir/man?/*
%changelog %changelog
* Thu Mar 11 2014 Ilya Mashkin <oddity@altlinux.ru> 3.8.9-alt1
- 3.8.9 (Closes: #25694)
* Wed Oct 22 2008 Ilya Mashkin <oddity@altlinux.ru> 3.8.6-alt1 * Wed Oct 22 2008 Ilya Mashkin <oddity@altlinux.ru> 3.8.6-alt1
- 3.8.6 - 3.8.6
......
CHANGES CHANGES
3.8.9 Wed Apr 25 09:24:25 CEST 2012
Thanks to Giacomo Picconi <giacomo.picconi@gpstudio.com> for:
- Fixing a long standing bug making the source not hidden.
3.8.8 Mon Nov 28 11:26:25 CEST 2012
"me".
3.8.7 Wed Feb 10 20:40:37 CET 2010
- Bug on 64bit systems with expiration dates.
3.8.6 Fri Jul 7 15:54:39 CEST 2006 3.8.6 Fri Jul 7 15:54:39 CEST 2006
Thanks to George Danchev <danchev@spnet.net> for: Thanks to George Danchev <danchev@spnet.net> for:
- License clarification about the rc4 implementation. - License clarification about the rc4 implementation.
......
...@@ -19,9 +19,9 @@ CFLAGS = -Wall -O -Ae ...@@ -19,9 +19,9 @@ CFLAGS = -Wall -O -Ae
CFLAGS = -w -verbose -fast -std1 -g0 CFLAGS = -w -verbose -fast -std1 -g0
# For GNU C compiler # For GNU C compiler
CFLAGS = -Wall -O6 -pedantic CFLAGS = -Wall # -O6 -pedantic
SHELL = /bin/sh #SHELL = /bin/sh
all: shc ask_for_test all: shc ask_for_test
...@@ -47,13 +47,26 @@ ask_for_strings: ...@@ -47,13 +47,26 @@ ask_for_strings:
@echo '*** ¿Do you want to see strings in the generated binary?' @echo '*** ¿Do you want to see strings in the generated binary?'
@echo '*** Please try... make strings' @echo '*** Please try... make strings'
strings: make_the_strings ask_for_install strings: make_the_strings ask_for_expiration
make_the_strings: match.x make_the_strings: match.x
@echo '*** Running: "strings -n 5 'match.x'"' @echo '*** Running: "strings -n 5 'match.x'"'
@echo '*** It must show no sensible information...' @echo '*** It must show no sensible information...'
strings -n 5 match.x strings -n 5 match.x
ask_for_expiration:
@echo '*** ¿Do you want to probe expiration date?'
@echo '*** Please try... make expiration'
expiration: til_yesterday ask_for_install
til_yesterday: shc match
@echo '*** Compiling "match" to expired date'
CFLAGS="$(CFLAGS)" ./shc -vvv -e `date "+%d/%m/%Y"` -f match
@echo '*** Running a compiled test script!'
@echo '*** It must fail showing "./match.x: has expired!"'
./match.x
ask_for_install: ask_for_install:
@echo '*** ¿Do you want to install shc?' @echo '*** ¿Do you want to install shc?'
@echo '*** Please try... make install' @echo '*** Please try... make install'
......
File deleted
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
*/ */
static const char my_name[] = "shc"; static const char my_name[] = "shc";
static const char version[] = "Version 3.8.6"; static const char version[] = "Version 3.8.9";
static const char subject[] = "Generic Script Compiler"; static const char subject[] = "Generic Script Compiler";
static const char cpright[] = "Copyright (c) 1994-2006"; static const char cpright[] = "Copyright (c) 1994-2012";
static const struct { const char * f, * s, * e; } static const struct { const char * f, * s, * e; }
author = { "Francisco", "Rosales", "<frosal@fi.upm.es>" }; author = { "Francisco", "Rosales", "<frosal@fi.upm.es>" };
...@@ -102,7 +102,7 @@ static const char * help[] = { ...@@ -102,7 +102,7 @@ static const char * help[] = {
#define SIZE 4096 #define SIZE 4096
static char * file; static char * file;
static time_t date[1]; static char date[21];
static char * mail = "Please contact your provider"; static char * mail = "Please contact your provider";
static char rlax[1]; static char rlax[1];
static char * shll; static char * shll;
...@@ -238,14 +238,14 @@ static const char * RTC[] = { ...@@ -238,14 +238,14 @@ static const char * RTC[] = {
"int chkenv(int argc)", "int chkenv(int argc)",
"{", "{",
" char buff[512];", " char buff[512];",
" unsigned mask, m;", " unsigned long mask, m;",
" int l, a, c;", " int l, a, c;",
" char * string;", " char * string;",
" extern char ** environ;", " extern char ** environ;",
"", "",
" mask = (unsigned)chkenv;", " mask = (unsigned long)&chkenv;",
" mask ^= (unsigned)getpid() * ~mask;", " mask ^= (unsigned long)getpid() * ~mask;",
" sprintf(buff, \"x%x\", mask);", " sprintf(buff, \"x%lx\", mask);",
" string = getenv(buff);", " string = getenv(buff);",
"#if DEBUGEXEC", "#if DEBUGEXEC",
" fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"<null>\");", " fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"<null>\");",
...@@ -253,11 +253,11 @@ static const char * RTC[] = { ...@@ -253,11 +253,11 @@ static const char * RTC[] = {
" l = strlen(buff);", " l = strlen(buff);",
" if (!string) {", " if (!string) {",
" /* 1st */", " /* 1st */",
" sprintf(&buff[l], \"=%u %d\", mask, argc);", " sprintf(&buff[l], \"=%lu %d\", mask, argc);",
" putenv(strdup(buff));", " putenv(strdup(buff));",
" return 0;", " return 0;",
" }", " }",
" c = sscanf(string, \"%u %d%c\", &m, &a, buff);", " c = sscanf(string, \"%lu %d%c\", &m, &a, buff);",
" if (c == 2 && m == mask) {", " if (c == 2 && m == mask) {",
" /* 3rd */", " /* 3rd */",
" rmarg(environ, &string[-l - 1]);", " rmarg(environ, &string[-l - 1]);",
...@@ -323,12 +323,14 @@ static const char * RTC[] = { ...@@ -323,12 +323,14 @@ static const char * RTC[] = {
" char * scrpt;", " char * scrpt;",
" int ret, i, j;", " int ret, i, j;",
" char ** varg;", " char ** varg;",
" char * me = getenv(\"_\");",
" if (me == NULL) { me = argv[0]; }",
"", "",
" stte_0();", " stte_0();",
" key(pswd, pswd_z);", " key(pswd, pswd_z);",
" arc4(msg1, msg1_z);", " arc4(msg1, msg1_z);",
" arc4(date, date_z);", " arc4(date, date_z);",
" if (date[0] && date[0]<time(NULL))", " if (date[0] && (atoll(date)<time(NULL)))",
" return msg1;", " return msg1;",
" arc4(shll, shll_z);", " arc4(shll, shll_z);",
" arc4(inlo, inlo_z);", " arc4(inlo, inlo_z);",
...@@ -357,24 +359,20 @@ static const char * RTC[] = { ...@@ -357,24 +359,20 @@ static const char * RTC[] = {
" arc4(chk2, chk2_z);", " arc4(chk2, chk2_z);",
" if ((chk2_z != tst2_z) || memcmp(tst2, chk2, tst2_z))", " if ((chk2_z != tst2_z) || memcmp(tst2, chk2, tst2_z))",
" return tst2;", " return tst2;",
" if (text_z < hide_z) {", " /* Prepend hide_z spaces to script text to hide it. */",
" /* Prepend spaces til a hide_z script size. */", " scrpt = malloc(hide_z + text_z);",
" scrpt = malloc(hide_z);", " if (!scrpt)",
" if (!scrpt)", " return 0;",
" return 0;", " memset(scrpt, (int) ' ', hide_z);",
" memset(scrpt, (int) ' ', hide_z);", " memcpy(&scrpt[hide_z], text, text_z);",
" memcpy(&scrpt[hide_z - text_z], text, text_z);",
" } else {",
" scrpt = text; /* Script text */",
" }",
" } else { /* Reexecute */", " } else { /* Reexecute */",
" if (*xecc) {", " if (*xecc) {",
" scrpt = malloc(512);", " scrpt = malloc(512);",
" if (!scrpt)", " if (!scrpt)",
" return 0;", " return 0;",
" sprintf(scrpt, xecc, argv[0]);", " sprintf(scrpt, xecc, me);",
" } else {", " } else {",
" scrpt = argv[0];", " scrpt = me;",
" }", " }",
" }", " }",
" j = 0;", " j = 0;",
...@@ -420,6 +418,7 @@ static int parse_an_arg(int argc, char * argv[]) ...@@ -420,6 +418,7 @@ static int parse_an_arg(int argc, char * argv[])
extern char * optarg; extern char * optarg;
const char * opts = "e:m:f:i:x:l:rvDTCAh"; const char * opts = "e:m:f:i:x:l:rvDTCAh";
struct tm tmp[1]; struct tm tmp[1];
time_t expdate;
int cnt, l; int cnt, l;
char ctrl; char ctrl;
...@@ -431,13 +430,17 @@ static int parse_an_arg(int argc, char * argv[]) ...@@ -431,13 +430,17 @@ static int parse_an_arg(int argc, char * argv[])
if (cnt == 3) { if (cnt == 3) {
tmp->tm_mon--; tmp->tm_mon--;
tmp->tm_year -= 1900; tmp->tm_year -= 1900;
date[0] = mktime(tmp); expdate = mktime(tmp);
} }
if (cnt != 3 || date[0] <= 0) { if (cnt != 3 || expdate <= 0) {
fprintf(stderr, "%s parse(-e %s): Not a valid value\n", fprintf(stderr, "%s parse(-e %s): Not a valid value\n",
my_name, optarg); my_name, optarg);
return -1; return -1;
} }
sprintf(date, "%lld", (long long)expdate);
if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate));
expdate = atoll(date);
if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate));
break; break;
case 'm': case 'm':
mail = optarg; mail = optarg;
...@@ -819,7 +822,7 @@ int write_C(char * file, char * argv[]) ...@@ -819,7 +822,7 @@ int write_C(char * file, char * argv[])
int pswd_z = sizeof(pswd); int pswd_z = sizeof(pswd);
char* msg1 = strdup("has expired!\n"); char* msg1 = strdup("has expired!\n");
int msg1_z = strlen(msg1) + 1; int msg1_z = strlen(msg1) + 1;
int date_z = sizeof(date); int date_z = strlen(date) + 1;
char* kwsh = strdup(shll); char* kwsh = strdup(shll);
int shll_z = strlen(shll) + 1; int shll_z = strlen(shll) + 1;
int inlo_z = strlen(inlo) + 1; int inlo_z = strlen(inlo) + 1;
...@@ -896,7 +899,7 @@ int write_C(char * file, char * argv[]) ...@@ -896,7 +899,7 @@ int write_C(char * file, char * argv[])
switch (indx) { switch (indx) {
case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;} case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;}
case 1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;} case 1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;}
case 2: if (date_z>=0) {prnt_array(o, date, "date", date_z, "(time_t*)"); date_z=done=-1; break;} case 2: if (date_z>=0) {prnt_array(o, date, "date", date_z, 0); date_z=done=-1; break;}
case 3: if (shll_z>=0) {prnt_array(o, shll, "shll", shll_z, 0); shll_z=done=-1; break;} case 3: if (shll_z>=0) {prnt_array(o, shll, "shll", shll_z, 0); shll_z=done=-1; break;}
case 4: if (inlo_z>=0) {prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z=done=-1; break;} case 4: if (inlo_z>=0) {prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z=done=-1; break;}
case 5: if (xecc_z>=0) {prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z=done=-1; break;} case 5: if (xecc_z>=0) {prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z=done=-1; break;}
......
shc-3.8.9.c
\ No newline at end of file
#! /usr/bin/ksh -x
echo "\$@ is $@"
echo "command line: $0 $*"
echo "hello world"
# Added
echo "[$$] PAUSED... Hit return!"
read DUMMY
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment