Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
43955cbf
Commit
43955cbf
authored
Jan 16, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better results fetching
parent
f65f108f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
22 deletions
+47
-22
asn1c/webcgi/asn1c.cgi
asn1c/webcgi/asn1c.cgi
+47
-22
No files found.
asn1c/webcgi/asn1c.cgi
View file @
43955cbf
...
@@ -16,6 +16,7 @@ $HashProgramPath = 'md5'; # Program to hash the input
...
@@ -16,6 +16,7 @@ $HashProgramPath = 'md5'; # Program to hash the input
$DM
=
0750
;
# Directory mode for all mkdirs.
$DM
=
0750
;
# Directory mode for all mkdirs.
$MaxHistoryItems
=
5
;
# Number of items in History
$MaxHistoryItems
=
5
;
# Number of items in History
$DynamicHistory
=
'
yes
';
# Full/Short history
$DynamicHistory
=
'
yes
';
# Full/Short history
$safeFilename
=
'
^[a-z0-9_-]+[.a-z0-9_-]*$
';
# Safe filename
$warn
=
'
<CENTER><FONT SIZE=+1><B>
';
$warn
=
'
<CENTER><FONT SIZE=+1><B>
';
$unwarn
=
'
</B></FONT></CENTER>
';
$unwarn
=
'
</B></FONT></CENTER>
';
...
@@ -116,6 +117,26 @@ sub prepareChrootEnvironment() {
...
@@ -116,6 +117,26 @@ sub prepareChrootEnvironment() {
return
1
;
return
1
;
}
}
sub
makeArchive
($$)
{
local
$TMPDIR
=
shift
;
local
$sandbox
=
shift
;
local
$archName
=
$sandbox
.
'
/+Archive.tgz
';
if
(
!
-
f
$archName
)
{
system
("
cd
$sandbox
&&
"
.
"
for i in ./*.[ch]; do if [ -L
\
$i
]; then
"
.
"
cp
$TMPDIR
/skeletons/
\
$i
\
$i
.-;
"
.
"
mv
\
$i
.-
\
$i
;
"
.
"
fi done && tar --dereference --ignore-failed-read --owner nobody --group nobody -zcf +tmp.
"
.
$$
.
"
*.[ch] Makefile* +Compiler.Log *.asn *.asn1
"
.
"
&& rm -f ./*.[ch] ./Makefile*
"
.
"
&& mv ./+tmp.
"
.
$$
.
"
$archName
"
.
"
|| rm -f ./+tmp.
"
.
$$
);
undef
unless
-
f
$archName
;
}
$archName
;
}
my
$EnvironmentSetOK
=
prepareChrootEnvironment
();
my
$EnvironmentSetOK
=
prepareChrootEnvironment
();
#
#
...
@@ -175,32 +196,31 @@ unless($session) {
...
@@ -175,32 +196,31 @@ unless($session) {
local
$trans
=
param
('
trans
');
local
$trans
=
param
('
trans
');
local
$fetch
=
param
('
fetch
');
local
$fetch
=
param
('
fetch
');
local
$show
=
param
('
show
');
local
$show
=
param
('
show
');
unless
(
$t
=~
/^[0-9TZ:+-]{14,}$/
&&
$trans
=~
/$safeFilename/i
)
{
unless
(
$t
=~
/^[0-9TZ:+-]{14,}$/
&&
$trans
=~
/^[.a-z0-9_-]+$/i
)
{
$fetch
=
'';
$fetch
=
'';
$show
=
'';
$show
=
'';
}
}
if
(
$fetch
=~
/
^[.a-z0-9_-]+$
/i
||
$show
=~
/^(log|tgz)$/
)
{
if
(
$fetch
=~
/
$safeFilename
/i
||
$show
=~
/^(log|tgz)$/
)
{
local
$
fname
=
$sessionDir
.
'
/
'
.
$t
.
'
--
'
.
$trans
;
local
$
sandbox
=
$sessionDir
.
'
/
'
.
$t
.
'
--
'
.
$trans
;
if
(
$show
eq
'
tgz
')
{
if
(
$show
eq
'
tgz
')
{
local
$tarball
=
makeArchive
(
$TMPDIR
,
$sandbox
);
defined
$tarball
or
bark
("
Cannot create archive [
$sandbox
]
");
printf
("
Content-Type: application/x-tar
\n
");
printf
("
Content-Type: application/x-tar
\n
");
printf
("
Content-Encoding: gzip
\n\n
");
printf
("
Content-Encoding: gzip
\n\n
");
exec
("
cd
$fname
&&
"
exec
("
cat
$tarball
");
.
"
for i in *.[ch]; do if [ -L
\
$i
]; then
"
.
"
cp
$TMPDIR
/skeletons/
\
$i
\
$i
.-;
"
.
"
mv
\
$i
.-
\
$i
;
"
.
"
fi done && tar --dereference --owner nobody --group nobody -zcvf - ./*.[ch] ./Makefile*
");
exit
(
0
);
exit
(
0
);
}
}
if
(
$show
eq
'
log
')
{
if
(
$show
eq
'
log
')
{
$
fname
.=
'
/+
Log
';
$
sandbox
.=
'
/+Compiler.
Log
';
}
else
{
}
else
{
$
fname
.=
'
/
'
.
$fetch
;
$
sandbox
.=
'
/
'
.
$fetch
;
}
}
open
(
I
,
"
<
"
.
$
fname
)
open
(
I
,
"
<
"
.
$
sandbox
)
or
bark
("
Invalid or outdated request: [
$
fname
] [
$show
] $!
");
or
bark
("
Invalid or outdated request: [
$
sandbox
] [
$show
] $!
");
printf
"
Content-Type: text/plain
\n\n
";
printf
"
Content-Type: text/plain
\n\n
";
while
(
<
I
>
)
{
while
(
<
I
>
)
{
print
;
print
;
...
@@ -280,13 +300,14 @@ if($#gotSafeNames >= 0) {
...
@@ -280,13 +300,14 @@ if($#gotSafeNames >= 0) {
$options
.=
"
-EF
"
if
(
param
("
optEF
")
eq
"
on
");
$options
.=
"
-EF
"
if
(
param
("
optEF
")
eq
"
on
");
$options
.=
"
-fnative-types
"
if
(
param
("
optNT
")
eq
"
on
");
$options
.=
"
-fnative-types
"
if
(
param
("
optNT
")
eq
"
on
");
my
$CompileASN
=
"
$TMPDIR
/bin/asn1c -v | sed -e 's/^/-- /'
"
my
$CompileASN
=
"
$TMPDIR
/bin/asn1c -v | sed -e 's/^/-- /'
"
.
"
>
$sandbox
/+Log 2>&1
"
.
"
>
$sandbox
/+
Compiler.
Log 2>&1
"
.
"
;
$SUIDHelper
$TMPDIR
$inChDir
$options
@gotSafeNames
"
.
"
;
$SUIDHelper
$TMPDIR
$inChDir
$options
@gotSafeNames
"
.
"
>>
$sandbox
/+Log 2>&1
"
.
"
>>
$sandbox
/+
Compiler.
Log 2>&1
"
.
"
; echo
\
$? >
$sandbox
/+ExitCode
";
.
"
; echo
\
$? >
$sandbox
/+ExitCode
";
system
(
$CompileASN
);
system
(
$CompileASN
);
bark
("
Failed to initiate compilation process: $!
")
bark
("
Failed to initiate compilation process: $!
")
if
(
!-
r
$sandbox
.
'
/+ExitCode
');
if
(
!-
r
$sandbox
.
'
/+ExitCode
');
makeArchive
(
$TMPDIR
,
$sandbox
);
}
}
#print join("<BR>\n", `env`);
#print join("<BR>\n", `env`);
...
@@ -378,21 +399,25 @@ foreach my $trans (sort { $b cmp $a } @transactions) {
...
@@ -378,21 +399,25 @@ foreach my $trans (sort { $b cmp $a } @transactions) {
.
"
Error during compilation:
$ec
</FONT><BR>
\n
";
.
"
Error during compilation:
$ec
</FONT><BR>
\n
";
}
}
$allowFetchResults
=
$ec
eq
"
0
"
&&
(
-
f
$sessionDir
.
'
/
'
.
$trans
.
'
/+Archive.tgz
'
||
-
f
$sessionDir
.
'
/
'
.
$trans
.
'
/Makefile.am.sample
');
$results
.=
"
<NOBR>
"
$results
.=
"
<NOBR>
"
.
(
(
$ec
eq
"
0
")
?
'
1.
'
:
'')
.
(
$allowFetchResults
?
'
1.
'
:
'')
.
"
<A HREF=
\"
$myName
?time=
"
.
"
<A HREF=
\"
$myName
/
$f
-
$tNum
.Log
?time=
"
.
escapeHTML
(
$origTime
)
.
escapeHTML
(
$origTime
)
.
"
&trans=
$f
"
.
"
&trans=
$f
"
.
"
&show=log
\"
>
"
.
"
&show=log
\"
>
"
.
"
Show compiler log</A></NOBR>
";
.
"
Show compiler log</A></NOBR>
";
if
(
$ec
eq
"
0
")
{
$results
.=
"
<BR>
\n
<NOBR>
"
$results
.=
"
<BR>
\n
<NOBR>
"
.
"
2. <A HREF=
\"
$myName
?time=
"
.
"
2. <A HREF=
\"
$myName
/
$f
-
$tNum
.tgz
?time=
"
.
escapeHTML
(
$origTime
)
.
escapeHTML
(
$origTime
)
.
"
&trans=
$f
"
.
"
&trans=
$f
"
.
"
&show=tgz
\"
>
"
.
"
&show=tgz
\"
>
"
.
"
Fetch results (.tgz)</A></NOBR>
";
.
"
Fetch results (.tgz)</A></NOBR>
"
}
else
{
if
$allowFetchResults
;
if
(
$ec
ne
"
0
")
{
$results
.=
'
<P>
'
$results
.=
'
<P>
'
.
'
<FONT SIZE=-1><A HREF="mailto:asn1c@lionet.info?Subject=asn1c compiler help:
'
.
'
<FONT SIZE=-1><A HREF="mailto:asn1c@lionet.info?Subject=asn1c compiler help:
'
.
"
transaction
$tNum
(
"
.
"
transaction
$tNum
(
"
...
...
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