chiark
/
gitweb
/
~ian
/
userv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct quoting of include-lookup directory. Closes:#837391. (With new directives...
[userv.git]
/
client.c
diff --git
a/client.c
b/client.c
index 60869b09af0d3478b3fb74ca87fd53d1040fece8..47600090ecc09fcda86200b41f3e08db83bf6463 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-2,7
+2,7
@@
* userv - client.c
* client code
*
* userv - client.c
* client code
*
- * Copyright (C)1996-1997,1999 Ian Jackson
+ * Copyright (C)1996-1997,1999
-2001,2003
Ian Jackson
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
@@
-132,7
+132,7
@@
static const char *loginname;
static char *cwdbuf;
static size_t cwdbufsize;
static char *ovbuf;
static char *cwdbuf;
static size_t cwdbufsize;
static char *ovbuf;
-static int ovused, systemerror;
+static int ovused, systemerror
, socketfd
;
static void blocksignals(int how) {
sigset_t set;
static void blocksignals(int how) {
sigset_t set;
@@
-432,8
+432,8
@@
static void usage(FILE *stream) {
"(separate with commas) append sync excl[usive] creat[e] fd\n"
"userv -B 'X' ... is same as userv --override 'execute-builtin X' - 'X' ...\n"
" for help, type `userv -B help'; remember to quote multi-word X\n"
"(separate with commas) append sync excl[usive] creat[e] fd\n"
"userv -B 'X' ... is same as userv --override 'execute-builtin X' - 'X' ...\n"
" for help, type `userv -B help'; remember to quote multi-word X\n"
- "userv and uservd version " VERSION VEREXT "
; copyright (C)1996-1999 Ian Jackson
.\n"
-
"there is NO WARRANTY; type `userv --copyright' for details.\n"
,
+ "userv and uservd version " VERSION VEREXT ".\n"
+
COPYRIGHT("","\n")
,
stream) < 0)
syscallerror("write usage message");
}
stream) < 0)
syscallerror("write usage message");
}
@@
-725,7
+725,9
@@
static void of_version(const struct optioninfo *oip, const char *value, char *ke
static void of_copyright(const struct optioninfo *oip, const char *value, char *key) {
if (fputs(
static void of_copyright(const struct optioninfo *oip, const char *value, char *key) {
if (fputs(
-" userv - user service daemon and client; copyright (C)1996-1999 Ian Jackson\n\n"
+" userv - user service daemon and client\n\n"
+COPYRIGHT(" ","\n")
+"\n"
" This is free software; you can redistribute it and/or modify it under the\n"
" terms of the GNU General Public License as published by the Free Software\n"
" Foundation; either version 2 of the License, or (at your option) any\n"
" This is free software; you can redistribute it and/or modify it under the\n"
" terms of the GNU General Public License as published by the Free Software\n"
" Foundation; either version 2 of the License, or (at your option) any\n"
@@
-735,9
+737,7
@@
static void of_copyright(const struct optioninfo *oip, const char *value, char *
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n"
" Public License for more details.\n\n"
" You should have received a copy of the GNU General Public License along\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n"
" Public License for more details.\n\n"
" You should have received a copy of the GNU General Public License along\n"
-" with userv; if not, write to Ian Jackson <ian@davenant.greenend.org.uk> or\n"
-" to the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n"
-" MA 02111-1307, USA.\n",
+" with userv; if not, see <http://www.gnu.org/licenses/>.\n",
stdout) < 0) syscallerror("write usage to stderr");
exit(0);
}
stdout) < 0) syscallerror("write usage to stderr");
exit(0);
}
@@
-809,7
+809,7
@@
static void security_init(void) {
mypid= getpid(); if (mypid == (pid_t)-1) syscallerror("getpid");
myuid= getuid(); if (myuid == (uid_t)-1) syscallerror("getuid");
mygid= getgid(); if (mygid == (gid_t)-1) syscallerror("getgid");
mypid= getpid(); if (mypid == (pid_t)-1) syscallerror("getpid");
myuid= getuid(); if (myuid == (uid_t)-1) syscallerror("getuid");
mygid= getgid(); if (mygid == (gid_t)-1) syscallerror("getgid");
- ngids= getgroups(0,0); if (ngids ==
(gid_t)
-1) syscallerror("getgroups(0,0)");
+ ngids= getgroups(0,0); if (ngids == -1) syscallerror("getgroups(0,0)");
gidarray= xmalloc(sizeof(gid_t)*ngids);
if (getgroups(ngids,gidarray) != ngids) syscallerror("getgroups(ngids,)");
gidarray= xmalloc(sizeof(gid_t)*ngids);
if (getgroups(ngids,gidarray) != ngids) syscallerror("getgroups(ngids,)");
@@
-1160,7
+1160,7
@@
static void prepare_asynchsignals(void) {
if (sigaction(SIGALRM,&sig,0)) syscallerror("set up sigalrm handler");
if (!timeout) return;
if (sigaction(SIGALRM,&sig,0)) syscallerror("set up sigalrm handler");
if (!timeout) return;
-
if (alarm(timeout)<0) syscallerror("set up timeout alarm"
);
+
alarm(timeout
);
}
}
@@
-1220,6
+1220,8
@@
static void connect_pipes(void) {
reading= fdsetup[fd].mods & fdm_read;
catdup(catnamebuf, fdsetup[fd].copyfd, reading ? 0 : 1);
catdup(catnamebuf, fdsetup[fd].pipefd, reading ? 1 : 0);
reading= fdsetup[fd].mods & fdm_read;
catdup(catnamebuf, fdsetup[fd].copyfd, reading ? 0 : 1);
catdup(catnamebuf, fdsetup[fd].pipefd, reading ? 1 : 0);
+ if (close(socketfd))
+ fsyscallerror("%s: close client socket for for cat",catnamebuf);
close_unwanted_pipes();
execl("/bin/cat",catnamebuf,(char*)0);
fprintf(stderr,"userv: %s: cannot exec `cat': %s\n",catnamebuf,strerror(errno));
close_unwanted_pipes();
execl("/bin/cat",catnamebuf,(char*)0);
fprintf(stderr,"userv: %s: cannot exec `cat': %s\n",catnamebuf,strerror(errno));
@@
-1326,7
+1328,7
@@
static void NONRETURNING process_exitstatus(int status) {
}
int main(int argc, char *const *argv) {
}
int main(int argc, char *const *argv) {
- int status
, socketfd
;
+ int status;
#ifdef NDEBUG
# error Do not disable assertions in this security-critical code !
#ifdef NDEBUG
# error Do not disable assertions in this security-critical code !