(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.
This commit is contained in:
Markus Armbruster 2007-11-16 20:27:09 +00:00
parent f757843ca5
commit b631cf944f
4 changed files with 2 additions and 60 deletions

View file

@ -54,7 +54,7 @@ VPATH = @srcdir@
prog = empire$E prog = empire$E
obj = expect.$O host.$O ioqueue.$O ipglob.$O login.$O main.$O queue.$O \ 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) all: $(prog)
@ -80,13 +80,11 @@ uninstall:
# FIXME generate from .d # FIXME generate from .d
expect.$O: misc.h expect.$O: misc.h
handle.$O: misc.h
host.$O: misc.h host.$O: misc.h
ioqueue.$O: misc.h queue.h ioqueue.h ioqueue.$O: misc.h queue.h ioqueue.h
login.$O: misc.h proto.h login.$O: misc.h proto.h
main.$O: misc.h proto.h queue.h ioqueue.h tags.h main.$O: misc.h proto.h queue.h ioqueue.h tags.h
queue.$O: misc.h queue.h queue.$O: misc.h queue.h
saveargv.$O: misc.h
servcmd.$O: misc.h proto.h queue.h ioqueue.h tags.h servcmd.$O: misc.h proto.h queue.h ioqueue.h tags.h
serverio.$O: misc.h queue.h ioqueue.h serverio.$O: misc.h queue.h ioqueue.h
tags.$O: misc.h tags.h tags.$O: misc.h tags.h

View file

@ -69,7 +69,7 @@ static void intr(int sig);
static int handleintr(int); static int handleintr(int);
int int
main(int ac, char **av) main(int ac, char **argv)
{ {
#ifdef _WIN32 #ifdef _WIN32
WORD wVersionRequested; WORD wVersionRequested;
@ -88,7 +88,6 @@ main(int ac, char **av)
int retry = 0; int retry = 0;
#endif #endif
struct ioqueue server; struct ioqueue server;
char *argv[128];
int i, j; int i, j;
char *ptr; char *ptr;
char *auxout_fname; char *auxout_fname;
@ -122,8 +121,6 @@ main(int ac, char **av)
FD_ZERO(&mask); FD_ZERO(&mask);
FD_ZERO(&savemask); FD_ZERO(&savemask);
#endif #endif
memset(argv, 0, sizeof(argv));
saveargv(ac, av, argv);
auxout_fname = NULL; auxout_fname = NULL;
auxout_fp = NULL; auxout_fp = NULL;
for (i = j = 1; i < ac; ++i) { for (i = j = 1; i < ac; ++i) {

View file

@ -67,7 +67,6 @@ int recvline(int s, char *buf);
int expect(int s, int match, char *buf); int expect(int s, int match, char *buf);
int tcp_connect(char *, char *); int tcp_connect(char *, char *);
int login(int s, char *uname, char *cname, char *cpass, int kill_proc, int); 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 sendcmd(int s, char *cmd, char *arg);
void servercmd(struct ioqueue *ioq, FILE *auxfi); void servercmd(struct ioqueue *ioq, FILE *auxfi);
int serverio(int s, struct ioqueue *ioq); int serverio(int s, struct ioqueue *ioq);

View file

@ -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 <config.h>
#include <stdlib.h>
#include <string.h>
#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++ = ' ';
}
}