From: Markus Armbruster Date: Fri, 16 Nov 2007 20:27:09 +0000 (+0000) Subject: (saveargv): Lame attempt at protecting users who foolishly specify X-Git-Tag: v4.3.11~119 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=b631cf944fdb1355d3b36f46951fb5ff55bedaa2 (saveargv): Lame attempt at protecting users who foolishly specify passwords on the command line. Antisocially zaps the complete command line, not just the password. Remove, at least for now. (main): Update accordingly. --- diff --git a/src/client/Makefile.in b/src/client/Makefile.in index 825d411e4..276fe3d02 100644 --- a/src/client/Makefile.in +++ b/src/client/Makefile.in @@ -54,7 +54,7 @@ VPATH = @srcdir@ prog = empire$E obj = expect.$O host.$O ioqueue.$O ipglob.$O login.$O main.$O queue.$O \ -saveargv.$O servcmd.$O serverio.$O tags.$O termio.$O termlib.$O +servcmd.$O serverio.$O tags.$O termio.$O termlib.$O all: $(prog) @@ -80,13 +80,11 @@ uninstall: # FIXME generate from .d expect.$O: misc.h -handle.$O: misc.h host.$O: misc.h ioqueue.$O: misc.h queue.h ioqueue.h login.$O: misc.h proto.h main.$O: misc.h proto.h queue.h ioqueue.h tags.h queue.$O: misc.h queue.h -saveargv.$O: misc.h servcmd.$O: misc.h proto.h queue.h ioqueue.h tags.h serverio.$O: misc.h queue.h ioqueue.h tags.$O: misc.h tags.h diff --git a/src/client/main.c b/src/client/main.c index 0d7943b31..f27de8b91 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -69,7 +69,7 @@ static void intr(int sig); static int handleintr(int); int -main(int ac, char **av) +main(int ac, char **argv) { #ifdef _WIN32 WORD wVersionRequested; @@ -88,7 +88,6 @@ main(int ac, char **av) int retry = 0; #endif struct ioqueue server; - char *argv[128]; int i, j; char *ptr; char *auxout_fname; @@ -122,8 +121,6 @@ main(int ac, char **av) FD_ZERO(&mask); FD_ZERO(&savemask); #endif - memset(argv, 0, sizeof(argv)); - saveargv(ac, av, argv); auxout_fname = NULL; auxout_fp = NULL; for (i = j = 1; i < ac; ++i) { diff --git a/src/client/misc.h b/src/client/misc.h index 31080cf73..2dc3bbd3c 100644 --- a/src/client/misc.h +++ b/src/client/misc.h @@ -67,7 +67,6 @@ int recvline(int s, char *buf); int expect(int s, int match, char *buf); int tcp_connect(char *, char *); int login(int s, char *uname, char *cname, char *cpass, int kill_proc, int); -void saveargv(int ac, char **src, char **dst); void sendcmd(int s, char *cmd, char *arg); void servercmd(struct ioqueue *ioq, FILE *auxfi); int serverio(int s, struct ioqueue *ioq); diff --git a/src/client/saveargv.c b/src/client/saveargv.c deleted file mode 100644 index 941df57bf..000000000 --- a/src/client/saveargv.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Empire - A multi-player, client/server Internet based war game. - * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak, - * Ken Stevens, Steve McClure - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * --- - * - * See files README, COPYING and CREDITS in the root of the source - * tree for related information and legal notices. It is expected - * that future projects/authors will amend these files as needed. - * - * --- - * - * saveargv.c: routine to copy and clear argv - * - * Known contributors to this file: - * - */ - -#include - -#include -#include -#include "misc.h" - -void -saveargv(int ac, char **src, char **dst) -{ - char *ptr; - int i; - - for (i = 0; i < ac; i++) { - dst[i] = strcpy(malloc(strlen(src[i]) + 1), src[i]); - ptr = src[i]; - while (*ptr) - *ptr++ = ' '; - } -}