Copyright (C) 1989 Free Software Foundation, Inc.
Author: Andy Norman (ange@hplb.hpl.hp.com), based on 'etc/server.c'
- from the 18.52 GNU Emacs distribution.
+ from the 18.52 GNU Emacs distribution.
Please mail bugs and suggestions to the author at the above address.
*/
#include <string.h>
#endif /* HAVE_STRING_H */
+#define xstrncpy(d_,s_,l_) \
+ do { \
+ char* dst_=d_; \
+ dst_[0]='\0'; \
+ strncat((dst_),(s_),(l_)-1); \
+ } while(0)
+
#if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
!defined(INTERNET_DOMAIN_SOCKETS)
}
/* if */
msgctl(ipc_qid, IPC_STAT, &msg_st);
- strncpy(buf, msgp->mtext, len);
- /* terminate buf */
- buf[len] = '\0';
+ xstrncpy(buf, msgp->mtext, sizeof(buf));
printf("%d %s", ipc_qid, buf);
fflush(stdout);
strcmp(auth_protocol, MCOOKIE_NAME)) {
printf("authentication protocol (%s) \
from client is invalid...\n\
-... Was the client an old version of gnuclient/gnudoit?\n", auth_protocol);
+... Was the client an old version of gnuclient?\n", auth_protocol);
return FALSE;
}
/* Check that access is allowed - if not return crud to the client */
if (!permitted(peer.sin_addr.s_addr, s)) {
send_string(s, "\
-gnudoit: Connection refused\ngnudoit: unable to connect to remote");
+gnuclient: Connection refused\ngnuclient: unable to connect to remote");
close(s);
printf("Refused connection from %s\n",
if ((s = accept(ls, (struct sockaddr *)&server, &len)) < 0) {
perror(progname);
fprintf(stderr, "%s: unable to accept\n", progname);
+ /* Nothing more we can do here... */
+ return;
}
echo_request(s);
return;