xtell-2.10.7/0000755000000000000000000000000011317447254007627 5ustar xtell-2.10.7/Makefile0000644000000000000000000000271407323071555011272 0ustar DESTDIR = BINDIR=$(DESTDIR)/usr/bin SBINDIR=$(DESTDIR)/usr/sbin MANDIR=$(DESTDIR)/usr/man CC = gcc CFLAGS = -g -Wall # -Wsurprising #if you have GNU libreadline and libident.so, you can use it: #LDFLAGS = -lreadline -lident #use the following line in case you have only libident.a, not shared #library (or you want to link staticly against libident) LDFLAGS = -lreadline /usr/lib/libident.a #LDFLAGS should stay empty if you do not have libident and GNU libreadline at all #LDFLAGS = #SunOS needs following: #LDFLAGS = -lreadline -lcurses -lsocket -lnsl #some OSes (e.g. OpenBSD) need -lcurses as well if you are using readline #for QNX: #LDFLAGS = -lsocket all: xtell xtelld xtelld: xtelld.o daemon.o child.o tty.o common.o $(CC) $(CFLAGS) xtelld.o daemon.o child.o tty.o common.o $(LDFLAGS) -o xtelld # strip xtelld xtell: xtell.o common.o $(CC) $(CFLAGS) xtell.o common.o $(LDFLAGS) -o xtell xtelld.o: xtelld.c $(CC) $(CFLAGS) -c xtelld.c daemon.o: daemon.c $(CC) $(CFLAGS) -c daemon.c child.o: child.c $(CC) $(CFLAGS) -c child.c tty.o: tty.c $(CC) $(CFLAGS) -c tty.c xtell.o: xtell.c $(CC) $(CFLAGS) -c xtell.c common.o: common.c $(CC) $(CFLAGS) -c common.c clean: rm -f *~ *.o xtell xtelld install: xtelld xtell cp xtelld $(SBINDIR) cp xtell $(BINDIR) install-doc: mkdir -p $(MANDIR)/man1 $(MANDIR)/man8 mkdir -p $(MANDIR)/man1 $(MANDIR)/man1 gzip -9 xtell.1 -c >$(MANDIR)/man1/xtell.1.gz gzip -9 xtelld.8 -c >$(MANDIR)/man8/xtelld.8.gz xtell-2.10.7/tty.c0000644000000000000000000002506007455104242010611 0ustar /* some routines here are taken from write(1), hence the following copyright */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "xtelld.h" #include #include #include #include #include #include #ifndef UT_LINESIZE struct utmp utmp_entry; #define UT_LINESIZE sizeof(utmp_entry.ut_line) #endif /* * term_chk - check that a terminal exists, and get the message bit * and the access time */ int term_chk(char *tty, int *msgsokP, time_t * atimeP) { struct stat s; char *path; int fd; /* if ((strncmp("tty", tty, 3) != 0) && (strncmp("pts/", tty, 4) != 0)) return 1; */ path = malloc(strlen(tty) + sizeof(TTYDIR) + 1); if (path == NULL) return 1; strcpy(path, TTYDIR); strcat(path, tty); if (stat(path, &s) < 0) { free(path); return (1); } if (!S_ISCHR(s.st_mode)) { /* check if it is really a character device */ free(path); return 1; } fd = open(path, O_WRONLY); free(path); if (fd==-1) return 1; if (!isatty(fd)) { close(fd); return 1; }; close(fd); *msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0; /* group write bit */ *atimeP = s.st_atime; return (0); } /* * search_utmp - search utmp for the "best" terminal to write to * * Ignores terminals with messages disabled, and of the rest, returns * the one with the most recent access time. Returns as value the number * of the user's terminals with messages enabled, or -1 if the user is * not logged in at all. * */ #ifdef CYGWIN short int search_utmp(user, tty) char *user, *tty; { strcpy(tty, "conin"); return 1; } #else #ifdef HAVE_GETUTENT short int search_utmp(user, tty) char *user, *tty; { struct utmp *u; time_t bestatime, atime; int msgsok; short int nloggedttys, nttys; char atty[UT_LINESIZE + 1]; setutent(); nloggedttys = nttys = 0; bestatime = 0; while ((u = getutent()) != NULL) if (u->ut_type == USER_PROCESS && strncmp(user, u->ut_name, sizeof(u->ut_name)) == 0) { ++nloggedttys; (void) strncpy(atty, u->ut_line, UT_LINESIZE); atty[UT_LINESIZE] = '\0'; if (term_chk(atty, &msgsok, &atime)) continue; /* bad term? skip */ if (!msgsok) continue; /* skip ttys with msgs off */ ++nttys; /* if this is a newly created tty (eg fresh * xterm), then user will not have typed at * it, and the atime will be way in the * past. So, if the atime is < utmp creation * time, use the utmp time. */ if (atime < u->ut_time) atime = u->ut_time; if (atime > bestatime) { bestatime = atime; (void) strcpy(tty, atty); } } endutent(); if (nloggedttys == 0) { return (-1); } /* if (nttys == 0) { return(-1); } */ return (nttys); } #else short int search_utmp(user, tty) char *user, *tty; { struct utmp u; time_t bestatime, atime; int ufd, msgsok; short int nloggedttys, nttys; char atty[UT_LINESIZE + 1]; if ((ufd = open(_PATH_UTMP, O_RDONLY)) < 0) { return (0); } nloggedttys = nttys = 0; bestatime = 0; while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u)) if ( /* u.ut_type == USER_PROCESS && */ strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) { ++nloggedttys; (void) strncpy(atty, u.ut_line, UT_LINESIZE); atty[UT_LINESIZE] = '\0'; if (term_chk(atty, &msgsok, &atime)) continue; /* bad term? skip */ if (!msgsok) continue; /* skip ttys with msgs off */ ++nttys; /* if this is a newly created tty (eg fresh * xterm), then user will not have typed at * it, and the atime will be way in the * past. So, if the atime is < utmp creation * time, use the utmp time. */ if (atime < u.ut_time) atime = u.ut_time; if (atime > bestatime) { bestatime = atime; (void) strcpy(tty, atty); } } (void) close(ufd); if (nloggedttys == 0) { return (-1); } /* if (nttys == 0) { return(-1); } */ return (nttys); } #endif /* HAVE_GETUTENT */ #endif /* CYGWIN */ /* * do_write - actually write it to tty */ int do_write(tty, buff) char *tty, *buff; { FILE *file; char path[20]; strcpy(path, TTYDIR); strncat(path, tty, sizeof(path) - 1 - sizeof(TTYDIR)); if (!(file = fopen(path, "w"))) { return (-1); } fprintf(file, "%s", buff); fclose(file); return (0); } /* * log_write - write log if you can */ short int log_write(const char *toluser, const char *buff) { int filedes; FILE *file; if ((filedes = logFILE(toluser)) != -1) { file = fdopen(filedes, "w"); if (!file) return 0; fprintf(file, "%s", buff); fclose(file); } return 0; } int parse_and_write(char *s, char *identity, char *addr, unsigned int msgcount) { char fromluser[MAX_LUSERNAME_LENGTH], toluser[MAX_LUSERNAME_LENGTH], totty[MAX_TTY_LENGTH]; char *firstcolon, *secondcolon, *thirdcolon; char foundtty[MAX_TTY_LENGTH+1]; char buffer[14 + MAX_LUSERNAME_LENGTH*3 + MAX_MSG_LENGTH + MAX_TIME_LENGTH + MAX_HOSTNAME]; unsigned int fromlusernamelength, tolusernamelength, tottylength; short search_result; char *poi; int msgok; time_t atime; fromluser[0] = toluser[0] = totty[0] = '\0'; firstcolon = strchr(s, ':'); if (!firstcolon) return -4; secondcolon = strchr(firstcolon + 1, ':'); if (!secondcolon) return -4; thirdcolon = strchr(secondcolon + 1, ':'); if (!thirdcolon) return -4; /* strictly speaking, this is incorrect, but we need to be able to send 8-bit characters... */ for (poi = s; (*poi) != '\0'; poi++) if ((unsigned int) (*poi) < 32) (*poi) = '?'; fromlusernamelength = firstcolon - s; if (fromlusernamelength > MAX_LUSERNAME_LENGTH) fromlusernamelength = MAX_LUSERNAME_LENGTH; tolusernamelength = secondcolon - firstcolon - 1; if (tolusernamelength > MAX_LUSERNAME_LENGTH) tolusernamelength = MAX_LUSERNAME_LENGTH; tottylength = thirdcolon - secondcolon - 1; if (tottylength > MAX_TTY_LENGTH) tottylength = MAX_TTY_LENGTH; strncat(fromluser, s, fromlusernamelength); strncat(toluser, firstcolon + 1, tolusernamelength); strncat(totty, secondcolon + 1, tottylength); if (tottylength == 0) { search_result = search_utmp(toluser, foundtty); if (search_result == -1) return -1; /* not logged in */ else if (search_result == 0) return -2; /* disabled messages */ } else { if (term_chk(totty, &msgok, &atime)) return -3; strncpy(foundtty, totty, sizeof(foundtty)-1); foundtty[sizeof(foundtty)-1]='\0'; } if (msgcount == 1) { time_t tim = time(NULL); char bleah[MAX_TIME_LENGTH]; strftime(bleah, sizeof(bleah), "%R %d-%b-%y", localtime(&tim)); if (identity == NULL) { strcpy(buffer, "\n\007~"); strcat(buffer, fromluser); strcat(buffer, "@"); strcat(buffer, addr); strcat(buffer, "["); strcat(buffer, bleah); strcat(buffer, "]:\n"); strcat(buffer, fromluser); strcat(buffer, ": "); strcat(buffer, thirdcolon + 1); strcat(buffer, "\n"); //snprintf(buffer, sizeof(buffer), "\n\007~%s@%s[%s]:\n%s: %s\n",fromluser, addr, bleah, fromluser, thirdcolon+1); } else if (fromlusernamelength!=0 && !strncmp(fromluser, identity, fromlusernamelength)) { strcpy(buffer, "\n\007"); strcat(buffer, fromluser); strcat(buffer, "@"); strcat(buffer, addr); strcat(buffer, "["); strcat(buffer, bleah); strcat(buffer, "]:\n"); strcat(buffer, fromluser); strcat(buffer, ": "); strcat(buffer, thirdcolon + 1); strcat(buffer, "\n"); //snprintf(buffer, sizeof(buffer), "\n\007%s@%s[%s]:\n%s: %s\n", fromluser, addr, bleah, fromluser, thirdcolon+1); } else { strcpy(buffer, "\n\007"); strcat(buffer, fromluser); strcat(buffer, "("); strncat(buffer, identity, MAX_LUSERNAME_LENGTH); strcat(buffer, ")@"); strcat(buffer, addr); strcat(buffer, "["); strcat(buffer, bleah); strcat(buffer, "]:\n"); strcat(buffer, fromluser); strcat(buffer, ": "); strcat(buffer, thirdcolon + 1); strcat(buffer, "\n"); //snprintf(buffer, sizeof(buffer), "\n\007%s(%s)@%s[%s]:\n%s: %s\n", fromluser, identity, addr, bleah, fromluser, thirdcolon+1); } } else { strcpy(buffer, "\007"); strcat(buffer, fromluser); strcat(buffer, ": "); strcat(buffer, thirdcolon + 1); strcat(buffer, "\n"); // snprintf(buffer, sizeof(buffer), "\007%s: %s\n", fromluser, thirdcolon+1); } log_write(toluser, buffer); if (do_write(foundtty, buffer) == -1) return -3; /* cannot write */ return 0; } xtell-2.10.7/xtell.10000644000000000000000000000450510304627464011043 0ustar .TH XTELL 1 .SH NAME xtell \- sends a message to another computer running xtelld .SH SYNOPSIS .B xtell [\-v] .BI "[user[:tty][@host[:port]]] [message]" .TP .B write .BI "user [tty]" .SH DESCRIPTION How to use it: suppose you want to send a message to user gubas on computer trener.fsport.uniba.sk Just type: prompt:~% xtell gubas@trener.fsport.uniba.sk Hi To send multiple lines long message to user 7tokarova at computer pascal.fmph.uniba.sk, type prompt:~% xtell 7tokarova@pascal.fmph.uniba.sk Hi How are you today Please answer ^D in this case, finish sending messages with EOF (CTRL D) If you want to send message to user holik on local computer, you can do it either by typing: prompt:~% xtell holik@localhost Hi or simply: prompt:~% xtell holik Hi To send message to certain tty, append the tty to username, separated by colon: prompt:~% xtell stanys:ttyp2@reaktor.ip.fmph.uniba.sk 'Sveikas Tomai' will send message 'Sveikas Tomai' to user stanys on ttyp2 at computer reaktor.ip.fmph.uniba.sk To specify other port than the default 4224, append the port to computer name, separated by colon: prompt:~% xtell bosa@radon.dnp.fmph.uniba.sk:4000 'Ahoj' assumes the xtell daemon runs at computer radon on port 4000, and sends the message 'Ahoj' to user bosa. Option \-v turns verbose mode on. Xtell will then display some messgaes about connecting, which is usefull especially when the connection is slow. Example: prompt:~% xtell \-v rybar@dmpc.dbp.fmph.uniba.sk xtell invoked without parameters will ask user for username and host to send the message to. If the user has created in his/her/its home directory the file .xtell-log, and the file is writable by nobody, all messages will be written to this file as well as to the screen (handy when the screen is overwritten and you could not see the message). xtell checks the environmental variable XTELLPROMPT. If it exists, it is used as prompt for messages. Last notice: if you do not think zsh is the best shell, (besides doing a mistake) replace prompt:~% in above text with prompt:~$ or whatever :-) .SH AUTHOR Radovan Garab\('ik (garabik@melkor.dnp.fmph.uniba.sk) .SH "SEE ALSO" .BR xtelld "(8), .BR write "(1), .BR talk "(1), .BR talkd "(8), .BR tty "(1) .SH BUGS What happens to .xtell-log when two messages arrive simultaneously? There is no locking implemented. xtell-2.10.7/xtell.c0000644000000000000000000002077007455104261011125 0ustar #include #include #include #include #include #include #include #include #include #include #include #include #include "xtelld.h" #include "config.h" #include unsigned short int verbose = 0; void verbose_message(char *s) { if (verbose == 1) { printf("%s", s); fflush(NULL); } } /* write_to_log - write log if you can */ short int write_to_log(const char *fromluser, const char *toluser, const char *message) { FILE *file; int filedes; time_t tim = time(NULL); char bleah[20]; strftime(bleah, sizeof(bleah), "%R %d-%b-%y", localtime(&tim)); if ((filedes = logFILE(fromluser)) != -1) { file = fdopen(filedes, "w"); if (!file) return -1; fprintf(file, "[%s] -> %s: %s\n", bleah, toluser, message); fclose(file); return 0; } return -1; } short int write_to_socket(int sock, const char *msg) { int retval; verbose_message("*** Writing to socket..."); retval = send(sock, msg, strlen(msg), 0); if (retval == -1) { return -1; } verbose_message("done.\n"); return 0; } static int connection = -1; /* socket */ short int make_new_connection(const struct hostent *hostentptr, const unsigned short int port) { static struct sockaddr_in sock2_name; /* Address str. for socket2 */ int retval; verbose_message("done.\n"); sock2_name.sin_family = hostentptr->h_addrtype; sock2_name.sin_port = htons(port); sock2_name.sin_addr = *((struct in_addr *) hostentptr->h_addr); if ((connection = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror("socket"); exit(1); } verbose_message("*** Connecting..."); retval = connect(connection, (struct sockaddr *) &sock2_name, sizeof(sock2_name)); if (retval) { perror("connect"); killsock(connection); close(connection); exit(1); } verbose_message("done.\n"); return 0; } unsigned short int write_message(const struct hostent *hostentptr, const unsigned short int port, const char *msg) { short int r; if (connection == -1) { /* new connection */ make_new_connection(hostentptr, port); } r = write_to_socket(connection, msg); if (r == -1) { /* there was an error writting to socket - retry it exactly once, in case it was caused by timeout */ killsock(connection); close(connection); make_new_connection(hostentptr, port); r = write_to_socket(connection, msg); if (r == -1) { perror("Error sending data"); return -1; } } return 0; } /* returns 0 - went ok, -1 - network or other error, 1 - refused message */ short int write_buffer(const struct hostent *hostentptr, const unsigned short int port, const char *buffer, const char *fromluser, const char *toluser, const char *message) { unsigned short int i; short int r; char recbuffer[MAX_REPLY_LENGTH]; for (i = 1; i <= 2; i++) { r = write_message(hostentptr, port, buffer); if (r != -1) { r = get_request(connection, recbuffer, sizeof(recbuffer)); if (r != -1) { break; } }; connection = -1; } if (r == -1) { perror("Error writing message"); return -1; } if (recbuffer[0] != '2') { printf("%s\n", recbuffer); return 1; } else { write_to_log(fromluser, toluser, message); return 0; } } char *readmessage(const char *prompt) { #ifndef USE_READLINE int c; unsigned int size = 0; char *np; #endif char *p; verbose_message("*** Waiting for you:\n"); #ifdef USE_READLINE p = readline(prompt); if (p) add_history(p); return p; #else printf("%s", prompt); p = malloc(1); while ((c = getchar()) != EOF) { if (c == '\n') break; size++; np = realloc(p, size + 1); if (np == NULL) { perror("Realloc failed"); exit(1); } p = np; p[size - 1] = (char) c; } if (c == EOF && size == 0) { free(p); return NULL; } p[size] = '\0'; return p; #endif } void usage(void) { fprintf(stderr, "Usage: xtell [-v] user[:tty][@hostname[:port]] [message]\n"); } int main(int argc, char **argv) { char *p; struct passwd *passs; short int r; int l; char fromluser[MAX_LUSERNAME_LENGTH], toluser[MAX_LUSERNAME_LENGTH] = "", totty[MAX_TTY_LENGTH] = ""; char buffer[MAX_SOCK_LENGTH]; unsigned int toport = XTELL_DEFAULT_PORT; char bufftoluser[MAX_LUSERNAME_LENGTH + MAX_TTY_LENGTH + 2] = ""; char buffhost[MAX_HOSTNAME + 10] = "", tohost[MAX_HOSTNAME] = ""; struct hostent *hostentptr; char *maybeuser; int mstart; unsigned int i = 1; unsigned short int noargs = 0; /* indicates there are no valid arguments */ char *prompt = "xtell> "; char *t; t = setlocale (LC_CTYPE, ""); if (argc == 1) { /* usage(); exit(1);*/ noargs = 1; } if ((p = getenv("XTELLPROMPT")) != NULL) { prompt = p; } if (!noargs) { if (!strcmp(argv[1], "--help")) { usage(); exit(1); } if (!strcmp(argv[1], "--version")) { printf("xtell %s\n", VERSION); exit(1); } if (!strcmp(argv[1], "-v")) { verbose = 1; printf("*** Verbose mode is on\n"); i++; if (argc == 2) { /* bad number of parameters */ /* usage(); exit(1);*/ noargs = 1; }; }; } if (noargs) { p = readmessage("User: "); if (p == NULL) exit(1); maybeuser = p; } else { maybeuser = argv[i]; }; if ((p = strchr(maybeuser, '@')) == NULL) { if (noargs) { p = readmessage("Host [localhost]: "); if (p == NULL) exit(1); if (!strcmp(p, "")) { if (gethostname(buffhost, MAX_HOSTNAME) < 0) { perror("Error in getting hostname"); strcpy(buffhost, "localhost"); } } else strncpy(buffhost, p, sizeof(buffhost) - 1); free(p); } else { if (gethostname(buffhost, MAX_HOSTNAME) < 0) { perror("Error in getting hostname"); strcpy(buffhost, "localhost"); }; } strncat(bufftoluser, maybeuser, sizeof(bufftoluser)); } else { strncat(bufftoluser, maybeuser, p - maybeuser); strncat(buffhost, p + 1, strlen(maybeuser) - (p - maybeuser)); } if ((p = strchr(bufftoluser, ':')) != NULL) { strncat(toluser, bufftoluser, p - bufftoluser); strncat(totty, p + 1, MAX_TTY_LENGTH); } else { strncpy(toluser, bufftoluser, sizeof(toluser)); } if ((p = strchr(buffhost, ':')) != NULL) { strncat(tohost, buffhost, p - buffhost); toport = atoi(p + 1); } else { strncpy(tohost, buffhost, sizeof(tohost)); } verbose_message("*** Getting host address..."); if ((hostentptr = gethostbyname(tohost)) == NULL) { printf("%s\n", tohost); perror("Host not found"); exit(1); } if ((passs = getpwuid(getuid())) != NULL) strncpy(fromluser, passs->pw_name, MAX_LUSERNAME_LENGTH); else { #ifdef USE_CUSERID cuserid(fromluser); #else strcpy(fromluser, "(unknown)"); #endif } if (argc > i + 1) { p = malloc(MAX_MSG_LENGTH + 1); p[0] = '\0'; strcpy(buffer, fromluser); strcat(buffer, ":"); strcat(buffer, toluser); strcat(buffer, ":"); strcat(buffer, totty); strcat(buffer, ":"); mstart = strlen(buffer); for (i++; i < argc; i++) { strcat(buffer, argv[i]); strcat(buffer, " "); strcat(p, argv[i]); strcat(p, " "); // snprintf (buffer, sizeof (buffer), "%s:%s:%s:%s\r\n", fromluser, // toluser, totty, argv[i]); } strcat(buffer, "\r\n"); r = write_buffer(hostentptr, toport, buffer, fromluser, toluser, p); free(p); } else { while ((p = readmessage(prompt)) != NULL) { if ((l = strlen(p)) >= MAX_MSG_LENGTH) { p = realloc(p, MAX_MSG_LENGTH + 1); p[MAX_MSG_LENGTH] = '\0'; fprintf(stderr, "Warning: line too long, cutting %d characters\n", l - MAX_MSG_LENGTH); } strcpy(buffer, fromluser); strcat(buffer, ":"); strcat(buffer, toluser); strcat(buffer, ":"); strcat(buffer, totty); strcat(buffer, ":"); mstart = strlen(buffer); strcat(buffer, p); strcat(buffer, "\r\n"); // snprintf(buffer, sizeof(buffer), "%s:%s:%s:%s\r\n", fromluser, // toluser, totty, p); r = write_buffer(hostentptr, toport, buffer, fromluser, toluser, p); free(p); } } verbose_message("*** Telling the other side we are through: "); write_message(hostentptr, toport, "QUIT\r\n"); verbose_message("done\n"); killsock(connection); close(connection); return (0); } /* end main */ xtell-2.10.7/README0000644000000000000000000001306407332247230010505 0ustar ========================================================= xtell Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ ========================================================= Xtell is a simple network messaging client, much like netwrite. I wrote it because such a client (and server) is running on local VAX machines, and I needed to send messages back and forth. Incidentaly, the VMS code (author Jozef 2Knepp) is based on similar unix code from Radovan Semancik, but this program is a bit too complicated for such a simple use and segfaults anyway :-). So I took ident2 program written by Michael Bacarella, wiped apart his auth code and replaced with mine. It is currently known to run on: Linux (probably everything with glibc 2.0 and higher), FreeBSD 4.2, Digital UNIX V4.0, HP-UX B.10.20, SunOS 5.7, AIX Version 4, OpenBSD 2.9 Windows NT with Cygwin (with some drawbacks) The program itself depends on libident (you can get it from ftp://ftp.lysator.liu.se/pub/ident/libs). If you cannot install it, you can still compile xtell, however, without ident the messages coming to you can be easily spoofed. xtell can optionally use GNU readline, if it is installed. How to compile and install: If you have debian system with all neccessary packages installed, type dpkg-buildpackage in the package's directory, then type dpkg -i ../xtell*deb Else: 1) edit config.h and pay attention to paths to libident and libreadline. make && make install if you are on *BSD, you have to use GNU make (gmake) instead of BSD make (or modify the makefile) 2) decide if you want to run it as daemon or from inetd (preferred) if daemon, just make sure it is started each time you boot your computer, and make sure xtelld is running with GID tty (recommended UID is either nobody or create another user) if from inetd, add this line to /etc/services : xtell 4224/tcp # xtell server and this line to /etc/inetd.conf : xtell stream tcp nowait nobody.tty /usr/sbin/tcpd /usr/local/sbin/xtelld Notice that the entries are separated by tabs, not spaces. 6) restart inetd with killall -HUP inetd 7) enjoy 8) what to do if you are a normal user and want to run xtell daemon: You can't run it from inetd, obviously. Just start ./xtelld to use xtell on default port (4224). In this case, xtell can write messages only to you. If there is another user on that system willing to get messages, either s/he starts xtelld on another port (e.g. ./xtelld -p4225), or makes his/her tty writable by you (e.g. chmod a+rw /dev/tty* -ignore error messages) How to use it: Suppose you want to send a message to user gubas on computer trener.fsport.uniba.sk Just type: prompt:~% xtell gubas@trener.fsport.uniba.sk Hi To send multiple lines long message to user 7tokarova at computer pascal.fmph.uniba.sk, type prompt:~% xtell 7tokarova@pascal.fmph.uniba.sk Hi How are you today Please answer ^D in this case, finish sending messages with EOF (CTRL D) If you want to send message to user holik on local computer, you can do it either by typing: prompt:~% xtell holik@localhost Hi or simply: prompt:~% xtell holik Hi To send message to certain tty, append the tty to username, separated by colon: prompt:~% xtell stanys:ttyp2@pedro.dnp.fmph.uniba.sk 'Sveikas Tomai' will send message 'Sveikas Tomai' to user stanys on ttyp2 at computer pedro.dnp.fmph.uniba.sk To specify other port than the default 4224, append the port to computer name, separated by colon: prompt:~% xtell bosa@radon.dnp.fmph.uniba.sk:4000 'Ahoj' assumes the xtell daemon runs at computer radon on port 4000, and sends the message 'Ahoj' to user bosa. Option -v turns verbose mode on. Xtell will then display some messgaes about connecting, which is usefull especially when the connection is slow. Example: prompt:~% xtell -v rybar@dmpc.dbp.fmph.uniba.sk If the user has created in his/her/its home directory the file .xtell-log, and the file is writable by nobody, all messages will be written to this file as well as to the screen (handy when the screen is overwritten and you could not see the message). One of very good examples how to use xtell is to put following into your .procmailrc file: :0 c * |/usr/bin/xtell you@at.your.computer 'You have new mail' or: :0 c * ^From.*important@user.somewhere.in.the.net* |/usr/bin/xtell you@somewhere.else 'New mail from important' This will tell you whenever you get a new mail from important@user.somewhere.in.the.net. Unlike biff, you can configure it to display only certain kinds of mails, and also unlike biff, it can send announcement about your new mail to another computer (running xtelld). If the user has created in his/her/its home directory the file .xtell-log, and the file is writable by the xtell daemon, all messages will be written to this file as well as to the screen (handy when the screen is overwritten and you could not see the message). xtell can be used as write(1) replacement, see included write.sh script. xtell checks the environmental variable XTELLPROMPT If it exists, it is used as prompt for messages. Y2K notice: xtell is NOT year 2000 compliant. This is intentional. This is A FEATURE. It saves two characters on your screen, which you will appreciate when you get a message from user@hostname with a long name. Besides, if messages on your screen last for more than one century, I will pay you all damage you may suffer from xtell not being Y2K compliant :-). Last notice: if you do not think zsh is the best shell, (besides doing a mistake) replace prompt:~% in above text with prompt:~$ or whatever :-) xtell-2.10.7/xtellreply0000755000000000000000000000124107270077377011767 0ustar #!/usr/bin/python # try to find out who sent you last xtell message and reply # to him/her import sys, os, string if len(sys.argv)>1: os.execvp("xtell", sys.argv) try: f = open(os.path.join(os.environ["HOME"], ".xtell-log")) except IOError: print "Sorry, cannot find out who called you last" sys.exit() f.seek(0, 2) # to the end of file buf = "" for i in xrange(2000): f.seek(-1,1) ch = f.read(1) f.seek(-1,1) if ch in string.digits+string.letters+"-@.": buf = ch + buf else: if '@' in buf: print "Replying to", buf os.execvp("xtell", ("xtell", buf)) sys.exit() buf = '' xtell-2.10.7/PROTOCOL0000644000000000000000000001016507266634046011023 0ustar Xtell Protocol This document briefly describes protocol used by xtell program. Motivation: There is a lack of program providing way of sending casual messages between remote computers. There exists well established unix utility write(1), which serves its purpose well, but its major drawback is that it is limited to a single host. Xtell tries to provide write-like facility for communicating between remote computers. Terminology: "Client" is program sending the message to remote computer "Server" is a daemon receiving the message and delivering it to specified user. Protocol: xtell server listens on TCP port (default 4224). Upon received connection, it reads lines separated by CRLF. Client indicates the end of connection by special command QUIT (case insensitive) sent as the last line of communication, terminated by CRLF, after which server should close the connection. After each read line (except QUIT), server sends the response back to the client. For response codes, see below. Each line is a separate message, which has the form: FROM:USER:DEVICE:MESSAGE FROM is the identity of user sending the message. The exact form is implementation dependent, but suggested form is the login name of user sending the message, if remote OS provides the information. Server could do further inquiries about the real identity of sender, to reduce the possible fake identities, for example by using IDENT protocol. Name of computer the connection is coming from is usually deduced from incoming TCP connection. FROM can be left empty if the client OS does not provide the information; however, server is not guaranteed to deliver messages with empty FROM. USER is the identity of user the message is intended for. If the local OS is single-user, dealing with this information is left to the implementation of xtell server (example implementation could ignore the USER parameter and display the message if OS does not have a "logged in user" notion, or check it and deliver the message only if logged in user matches USER parameter). USER can be left empty, if the notion of logged in user is meaningless on server OS. DEVICE further specifies the message delivery, in case of more possibilities. For server running on UNIX, typical usage of DEVICE is the name of tty the message should be delivered to in case of multiple times logged user. DEVICE can be left empty (and usually it is), in which case server should try to find "best possible device" to deliver the message to - usually the terminal with minimal idle time. (the alternative, to deliver message to all the devices user is logged into, is also possible and actually used in VMS implementation) FROM, USER and DEVICE must not contain colons. MESSAGE is the text of the message delivered to user. No other limitations on the message are imposed, however, it is strongly recommended that the message is sent as 7-bit ASCII or superset of ASCII. For communication where use of text encoding other than ASCII is convenient, it is suggested that the encoding is UTF-8. Although the length of MESSAGE is not limited, typical xtell implementation could impose further limits. Typically, xtell is intended for short messages, up to a few lines of text (several hundreds of bytes) RESPONSE CODES: Response form simple line, terminated with CRLF. Response has form: NNN response_text where NNN is a 3-digit numerical code, and response text has an informative character and in case of error replies intended for the user. Numerical code can start either with digit '2' in case of successfully sent message, or with digit '4' in case of failure. Second 2 digits can be used to specify more precisely the type of response. For example, responses can look like this: 200 - message sent 403 - user is not currently logged in 404 - user has indicated that s/he does not want to receive messages (mesg n) 405 - there was an error writing to specified device - either user has disabled sending messages to the device client specifies, or, if client does not explicitly specify a device, the message could not have been delivered. 406 - syntax error, format of line was not recognised xtell-2.10.7/debian/0000755000000000000000000000000011317447255011052 5ustar xtell-2.10.7/debian/po/0000755000000000000000000000000011317447255011470 5ustar xtell-2.10.7/debian/po/zh_TW.po0000644000000000000000000000332011317446662013062 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # msgid "" msgstr "" "Project-Id-Version: xtell 2.10\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2005-02-03 20:30+0800\n" "Last-Translator: Asho Yeh \n" "Language-Team: Chinese (traditional) \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Chinese\n" "X-Poedit-Country: TAIWAN\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "您希望 xtell daemon 能透過 inetd 啟動嗎?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "預設情況是 xtelld 是透過 inetd 啟動。" #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "但是,您能以獨立模式的 daemon 啟動。如果取消,xtell daemon 將會在開機時自動啟" "動。" #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "如果不確定,請選擇 Yes" xtell-2.10.7/debian/po/templates.pot0000644000000000000000000000212511317446661014212 0ustar # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "" #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "" xtell-2.10.7/debian/po/da.po0000644000000000000000000000243611317446662012422 0ustar # translation of xtell_2.10.1_da.po to Danish # Claus Hindsgaul , 2004. # msgid "" msgstr "" "Project-Id-Version: xtell_2.10.1_da\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2004-02-17 20:47+0100\n" "Last-Translator: Claus Hindsgaul \n" "Language-Team: Danish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.0.2\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Vil du have xtell-dæmonen til at køre fra inetd?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "xtelld kører som standard fra inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Du kan dog også køre den som selvstændig (standalone) dæmon. Hvis duvælger " "Nej, vil xtell-dæmonen automatisk blive startet under opstarten." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Hvis du er i tvivl, så vælg Ja." xtell-2.10.7/debian/po/de.po0000644000000000000000000000331611317446662012424 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: xtell 2.10\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2003-02-05 15:26+0100\n" "Last-Translator: Jörg Rieger \n" "Language-Team: none\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Möchten Sie den xtell Daemon von inetd aus starten?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Standardmäßig wird xtelld von inetd aufgerufen." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Sie können ihn jedoch auch als eigentständigen Daemon laufen lassen. Wenn " "Sie Nein auswählen, wird der xtell Daemon automatisch beim Booten gestartet." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Wenn Sie sich nicht sicher sind, wählen Sie Ja." xtell-2.10.7/debian/po/cs.po0000644000000000000000000000326011317446662012437 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # msgid "" msgstr "" "Project-Id-Version: xtell\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2005-06-18 08:09+0200\n" "Last-Translator: Miroslav Kure \n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Schcete spouštět daemona xtell z inetd?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Implicitně se xtelld spouští z inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Nicméně pokud budete chtít, můžete jej spouštět jako samostatný daemon. " "Vyberete-li Ne, bude se xtelld spouštět automaticky při startu systému." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Pokud si nejste jisti, odpovězte Ano." xtell-2.10.7/debian/po/es.po0000644000000000000000000000345311317446662012445 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # # Carlos Alberto Martn Edo , 2003 # msgid "" msgstr "" "Project-Id-Version: xtell 2.10.1\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2003-07-14 13:36+0200\n" "Last-Translator: Carlos Alberto Martn Edo carlos@dat.etsit.upm.es>\n" "Language-Team: Debian L10n Spanish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-15\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Quiere que el demonio de xtell se ejecute desde inetd?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Por defecto, xtelld se ejecuta desde inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Sin embargo, puede ejecutarlo como un demonio independiente. Si selecciona " "No, el demonio de xtell se iniciar automticamente en el momento de " "arrancar." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "En caso de duda, seleccione S" xtell-2.10.7/debian/po/fr.po0000644000000000000000000000337311317446662012446 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # msgid "" msgstr "" "Project-Id-Version: xtell 2.10\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2003-03-11 21:31+0100\n" "Last-Translator: Philippe Batailler \n" "Language-Team: French\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-15\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Voulez-vous faire fonctionner le dmon xtell partir de inetd ?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Par dfaut, xtelld fonctionne partir de inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Cependant vous pouvez le faire fonctionner en mode autonome. Si vous " "rpondez ngativement, le dmon xtell sera lanc automatiquement lors du " "dmarrage de la machine." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "En cas de doute, acceptez cette option." xtell-2.10.7/debian/po/ja.po0000644000000000000000000000324211317446662012424 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # # msgid "" msgstr "" "Project-Id-Version: xtell 2.10.1\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2004-07-05 7:37+0900\n" "Last-Translator: Hideki Yamane \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=EUC-JP\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "inetd xtell ǡư褦ˤޤ?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "ɸǤϡxtelld inetd 鵯ưޤ" #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "ʤ顢ɥʥǡȤƤⵯưǤޤ֤פ" "硢ư˼ưŪ˳Ϥޤ" #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "̵ϡ֤ϤפǤ" xtell-2.10.7/debian/po/nl.po0000644000000000000000000000333211317446662012443 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # msgid "" msgstr "" "Project-Id-Version: xtell 2.10\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2003-08-13 18:13+0100\n" "Last-Translator: Bart Cornelis \n" "Language-Team: dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Wenst u de xtell-daemon vanuit inetd te draaien?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "De default is om xtelld vanuit inetd te draaien." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Het is echter mogelijk om het als een losstaande daemon te draaien. Indien u " "negatief antwoord zal de xtell daemon automatisch opgestart worden bij het " "opstarten." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Indien u onzeker bent, antwoord dan positief." xtell-2.10.7/debian/po/pt.po0000644000000000000000000000245411317446662012461 0ustar # Portuguese translation of xtell's debconf messages. # Luísa Lourenço , 2006. # # msgid "" msgstr "" "Project-Id-Version: xtell 2.10.4\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Luísa Lourenço \n" "Language-Team: Native Portuguese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Quer que o daemon xtell corra a partir do inetd?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Por omissão, xtelld corre a partir do inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "No entanto, pode correr como 'standalone daemon'. Se selecionar Não, o " "daemon xtell irá ser iniciado automaticamente durante o arranque do sistema." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Se não tem a certeza, seleccione Sim" xtell-2.10.7/debian/po/ru.po0000644000000000000000000000355711317446662012471 0ustar # # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # # Developers do not need to manually edit POT or PO files. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: xtell 2.10\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2003-02-05 15:26+0100\n" "Last-Translator: Илгиз Kaлмeтeв (Ilgiz Kalmetev) \n" "Language-Team: none\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Хотите, чтобы демон xtell работал из inetd?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "По умолчанию, xtelld запускается из inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Однако, вы можете запустить его как отдельный демон. Если вы выбираете НЕТ, " "то демон xtell будет запущен автоматически во время загрузки." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Если не уверены в своем выборе, выберите ДА" xtell-2.10.7/debian/po/sv.po0000644000000000000000000000312111317446662012456 0ustar # Translators, if you are not familiar with the PO format, gettext # documentation is worth reading, especially sections dedicated to # this format, e.g. by running: # info -n '(gettext)PO Files' # info -n '(gettext)Header Entry' # Some information specific to po-debconf are available at # /usr/share/doc/po-debconf/README-trans # or http://www.debian.org/intl/l10n/po-debconf/README-trans # Developers do not need to manually edit POT or PO files. # , fuzzy # # msgid "" msgstr "" "Project-Id-Version: xtell 2.10.3\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2005-09-28 23:59-0700\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "Vill du kra xtell daemonen frn inetd?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Standard r att xtelld krs frn inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Du kan kra den som en ensam daemon. Om du vljer Nej kommer xtell daemonen " "att startas automatiskt vid uppstart av systemet." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Om du r osker, vlj Ja" xtell-2.10.7/debian/po/vi.po0000644000000000000000000000305111317446662012446 0ustar # Vietnamese translation for XTell. # Copyright © 2005 Free Software Foundation, Inc. # Clytie Siddall , 2005. # msgid "" msgstr "" "Project-Id-Version: xtell 2.10.1-0.1\n" "Report-Msgid-Bugs-To: xtell@packages.debian.org\n" "POT-Creation-Date: 2010-01-01 20:32+0100\n" "PO-Revision-Date: 2005-08-21 21:13+0930\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0\n" "X-Generator: LocFactoryEditor 1.2.2\n" #. Type: boolean #. Description #: ../templates:1001 msgid "Do you want xtell daemon to run from inetd?" msgstr "" "Bạn có muốn chạy trình nền (dæmon) xtell từ siêu trình nền inetd không?" #. Type: boolean #. Description #: ../templates:1001 msgid "By default, xtelld runs from inetd." msgstr "Mặc định là xtelld chạy từ inetd." #. Type: boolean #. Description #: ../templates:1001 msgid "" "However, you can run it as standalone daemon. If you select No, xtell daemon " "will be started automatically at boot time." msgstr "" "Tùy nhiên, bạn cũng có thể chạy nó là trình nền độc lập. Nếu bạn chọn « Không " "» (no) thì trình nền xtell sẽ tự động được khởi chạy khi khởi động hệ thống." #. Type: boolean #. Description #: ../templates:1001 msgid "If unsure, select Yes" msgstr "Nếu bạn chưa chắc thì hãy chọn « Có » (yes)." xtell-2.10.7/debian/po/POTFILES.in0000644000000000000000000000004407620217426013240 0ustar [type: gettext/rfc822deb] templates xtell-2.10.7/debian/dirs0000644000000000000000000000002107153652401011721 0ustar usr/bin usr/sbin xtell-2.10.7/debian/docs0000644000000000000000000000002207266634417011725 0ustar README PROTOCOL xtell-2.10.7/debian/init0000644000000000000000000000263110774660235011743 0ustar #! /bin/sh -e ### BEGIN INIT INFO # Provides: xtell # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO # # This file was automatically customized by debmake on Mon, 23 Dec 1996 20:27:43 -0800 # # Written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux by Ian Murdock . # Modified for Debian by Christoph Lameter PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/sbin/xtelld # The following value is extracted by debstd to figure out how to generate # the postinst script. Edit the field to change the way the script is # registered through update-rc.d (see the manpage for update-rc.d!) FLAGS="defaults 50" test -f $DAEMON || exit 0 if [ -f /etc/xtelldrc ]; then . /etc/xtelldrc fi if [ "$FROMINETD" != "yes" ]; then case "$1" in start) echo "Starting xtelld..." start-stop-daemon --chuid xtelld:tty --start --quiet --exec $DAEMON ;; stop) start-stop-daemon --stop --verbose --exec $DAEMON sleep 2 ;; restart|force-reload) echo "Restarting $DAEMON..." start-stop-daemon --stop --quiet --exec $DAEMON sleep 2 start-stop-daemon --chuid xtelld:tty --start --quiet --exec $DAEMON ;; *) echo "Usage: /etc/init.d/$0 {start|stop|restart|force-reload}" exit 1 ;; esac fi exit 0 xtell-2.10.7/debian/control0000644000000000000000000000112011317445576012453 0ustar Source: xtell Section: net Priority: optional Maintainer: Radovan Garabík Standards-Version: 3.7.2 Build-Depends: libreadline-dev, libident-dev, debhelper (>= 4.1.16), po-debconf Package: xtell Architecture: any Pre-Depends: update-inetd, adduser Depends: ${shlibs:Depends}, netbase (>= 4.06), debconf Description: Simple messaging client and server, sort of networked write Simple messaging client and server, allowing you to send messages from computer running xtell client to computer running xtelld server. Can be used as replacement for write(1). xtell-2.10.7/debian/prerm0000644000000000000000000000030410357540245012113 0ustar #! /bin/sh # pre removal script for the Debian GNU/Linux efingerd package set -e # for upgrading older packages update-inetd --remove '4224\t.*' update-inetd --remove 'xtell\t.*' #DEBHELPER# xtell-2.10.7/debian/rules0000755000000000000000000000325311104664362012127 0ustar #!/usr/bin/make -f # MAde with the aid of dh_make, by Craig Small # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. # Some lines taken from debmake, by Cristoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 #export DH_COMPAT=4 build: build-stamp build-stamp: dh_testdir # Add here commands to compile the package. $(MAKE) LDFLAGS="-lreadline -lident" touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp install-stamp # Add here commands to clean up after the build process. -$(MAKE) clean debconf-updatepo dh_clean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/tmp. $(MAKE) install DESTDIR=`pwd`/debian/xtell touch install-stamp # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install # dh_testversion dh_testdir dh_testroot dh_installdocs dh_installexamples dh_installmenu # dh_installemacsen dh_installcron dh_installman xtell.1 xtelld.8 # dh_undocumented dh_installchangelogs dh_strip dh_compress dh_fixperms dh_installdebconf # chown root.tty debian/tmp/usr/sbin/xtelld # chmod g+s debian/tmp/usr/sbin/xtelld # dh_suidregister dh_installinit dh_installdeb dh_shlibdeps dh_gencontrol # dh_makeshlibs dh_md5sums dh_builddeb source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary xtell-2.10.7/debian/changelog0000644000000000000000000002511311317445113012715 0ustar xtell (2.10.7) unstable; urgency=low * replace the libreadline5-dev build dependency with libreadline-dev (closes: #553881) -- Radovan Garabík Fri, 01 Jan 2010 20:14:55 +0100 xtell (2.10.6) unstable; urgency=low * Move 'adduser' from Depends to Pre-Depends (see #502706 again). Thanks to Stefan Lesicnik for pointing this out. -- Radovan Garabík Thu, 06 Nov 2008 22:54:06 +0100 xtell (2.10.5+nmu3) unstable; urgency=medium * Non-maintainer upload. * Move Depends on 'update-inetd' to Pre-Depends - update-inetd is required in the *pre*inst, not postinst. Thanks to Adam D. Barratt (Closes: #502706). -- Chris Lamb Mon, 20 Oct 2008 23:40:37 +0100 xtell (2.10.5+nmu2) unstable; urgency=medium * Non-maintainer upload. * Add missing Depends on 'update-inetd' to ensure the presence of /usr/sbin/update-inetd in postinst script. (Closes: #502706) -- Chris Lamb Mon, 20 Oct 2008 23:18:01 +0100 xtell (2.10.5+nmu1) unstable; urgency=low * Non-maintainer upload. * Added LSB formatted dependency info in init.d script (closes: #469807) -- Peter Eisentraut Wed, 02 Apr 2008 12:32:01 +0200 xtell (2.10.5) unstable; urgency=low * add Portuguese debconf template (closes: #383390) -- Radovan Garabík Sat, 17 Feb 2007 17:27:17 +0100 xtell (2.10.4) unstable; urgency=low * fixed debconf dependency (closes: #332161) * included Swedish debconf template (closes:#330618) * don't divert write (caused problems since write is now managed with update-alternatives) -- Radovan Garabík Sat, 31 Dec 2005 22:19:38 +0200 xtell (2.10.3) unstable; urgency=low * rebuilt with libreadline5-dev (closes: #326281) -- Radovan Garabík Wed, 7 Sep 2005 08:57:17 +0200 xtell (2.10.2) unstable; urgency=low * New Vietnamese translation thanks Clytie Siddall (closes: #324274) * New Czech translation thanks Miroslav Kuře (closes: #314771) * Updated German translation thanks Jens Seidel (closes: #313858) * add acute accent in my name to manpages * depend on adduser -- Radovan Garabík Mon, 29 Aug 2005 17:47:58 +0200 xtell (2.10.1-0.1) unstable; urgency=low * Non-maintainer upload for fixing l10n issues * Translations: - Updated Danish translation thanks Claus Hindsgaul (closes: #233273) - Updated Spanish translation thanks Carlos Alberto Martín Edo (closes: #201562) - New Dutch translation thanks Bart Cornelis (closes: #205355) - New Japanese translation thanks Hideki Yamane (closes: #259796) - New Traditional Chinese translation thanks Asho Yeh * Lintian fixes: - Remove initial capital letter in the package description - Escape hyphens used as minus sign -- Luk Claes Tue, 25 Jan 2005 09:30:39 +0100 xtell (2.10.1) unstable; urgency=low * added french debconf template, thanks to Philippe Batailler , closes: #184780 -- Radovan Garabík Tue, 1 Apr 2003 13:30:19 +0200 xtell (2.10) unstable; urgency=low * switched debconf templates translations into po-debconf * danish template added, thanks to Michael Kristensen (closes: #174729) -- Radovan Garabik Wed, 5 Feb 2003 15:46:56 +0100 xtell (2.9) unstable; urgency=low * fixed race condition when writing to logfile -- Radovan Garabik Wed, 10 Apr 2002 19:48:10 +0200 xtell (2.8) unstable; urgency=low * fixed unterminated string bug in reverse DNS lookup and another one in checking for given tty filename * Russian debconf template added, thanks to Илгиз Калметев (Ilgiz Kalmetev) -- Radovan Garabik Fri, 22 Mar 2002 20:09:22 +0100 xtell (2.7) unstable; urgency=high * better checking for array sizes - fixes some buffer overflows and consequently remote shell exploits * test if specified tty is actually a terminal - fixes possibility of a DOS attack -- Radovan Garabik Fri, 1 Mar 2002 21:20:27 +0100 xtell (2.6.1) unstable; urgency=low * since xtell was added to /etc/services in netbase 4.06, we can do proper thing when adding entry to /etc/inetd.conf -- Radovan Garabik Sun, 21 Oct 2001 16:30:12 +0200 xtell (2.6) unstable; urgency=low * reconnecting to broken servers should now work * Spanish debconf template added (closes: #102992), thanks to Carlos Valdivia Yagüe -- Radovan Garabik Thu, 12 Jul 2001 14:31:34 +0200 xtell (2.5) unstable; urgency=low * several more improvement * again better portability * documentation updates * check for hostname when xtell client starts * corrected typo in strftime format string (nobody noticed, eh? :-)) * added simple xtellreply script to /usr/share/doc/xtell/examples (closes: #78130) -- Radovan Garabik Mon, 16 Apr 2001 21:23:45 +0200 xtell (2.4) unstable; urgency=low * client mostly rewritten from scratch, many minor improvements * some improvements in the server, too * removed binaries from tarball and fixed debian/rules to remove them automatically (closes: #94043) * added German debconf template (closes: #94148), thanks to Jörg Rieger * better portability -- Radovan Garabik Mon, 16 Apr 2001 17:58:56 +0200 xtell (2.3) unstable; urgency=low * removed autoconf, it just made troubles * use debconf * various code cleanups and tweaks -- Radovan Garabik Mon, 9 Apr 2001 23:39:27 +0200 xtell (2.2) unstable; urgency=low * ask for ident only first time a connection is made (closes: #76016) * removed superflous \n in replies -- Radovan Garabik Wed, 1 Nov 2000 09:30:02 +0100 xtell (2.1.1) unstable; urgency=low * rebuilt with a new GPG key -- Radovan Garabik Fri, 1 Sep 2000 08:54:02 +0200 xtell (2.1) unstable; urgency=low * fixed broked diversion -- Radovan Garabik Tue, 22 Feb 2000 13:20:51 +0100 xtell (2.0) unstable; urgency=low * moved to autoconf & automake * do not create .xtell-log if it does not exist * better init.d script * move dh_installinit after dh_suidregister in debian/rules to avoid premature execution when upgrading -- Radovan Garabik Mon, 14 Feb 2000 21:19:37 +0100 xtell (1.91) unstable; urgency=low * Updated Standards-Version * Compiled with new libreadline * Uses suidregister -- Radovan Garabik Fri, 7 Jan 2000 21:40:49 +0100 xtell (1.9) unstable; urgency=low * Better dealing with broken servers -- Radovan Garabik Tue, 23 Nov 1999 18:50:18 +0100 xtell (1.8) unstable; urgency=low * Oversight from previous versions in documentation corrected. * I again forgot to increase the version number.... fixed now. -- Radovan Garabik Wed, 3 Nov 1999 10:01:25 +0100 xtell (1.7) unstable; urgency=low * linked with GNU readline library -- Radovan Garabik Fri, 29 Oct 1999 15:34:06 +0200 xtell (1.6) unstable; urgency=low * Fix typo in description. (Closes: #48056) * Put Radovan's name back in the maintainer field; I misunderstood how this whole "sponsor" thing is supposed to work. -- Chris Lawrence Sat, 23 Oct 1999 15:23:17 -0500 xtell (1.5) unstable; urgency=low * upgraded Standards-Version * Radovan Garabik is the person responsible for this package; I am his sponsor and uploading it on his behalf. -- Chris Lawrence Wed, 13 Oct 1999 22:02:27 +0200 xtell (1.4) unstable; urgency=low * messages can contain 8-bit characters * call start-stop-demon with path - it did break on some systems * build with new debhelper - FHS compliant * diversion for write(1) added - this time properly * documentation update -- Radovan Garabik Sun, 3 Oct 1999 21:42:56 +0200 xtell (1.3) unstable; urgency=low * the date used month number instead of day number... Oops. Fixed now. * increased version number which was still 1.1.... Double oops. -- Radovan Garabik Thu, 26 Aug 1999 10:19:16 +0200 xtell (1.2) unstable; urgency=low * make xtell run as nobody in /etc/init.d/xtelld -- Radovan Garabik Sun, 1 Aug 1999 18:51:18 +0200 xtell (1.1) unstable; urgency=low * disabled diversion to write - we are playing it safe :-) * runs as daemon by default, not from inetd. -- Radovan Garabik Thu, 29 Jul 1999 10:07:53 +0200 xtell (1.0) unstable; urgency=low * added write-compatibility mode * manual page updates * added diversion to write for debian package * replaced % with : to separate port from hostname * added logging of outgoing messages -- Radovan Garabik Tue, 8 Jun 1999 10:15:32 +0200 xtell (0.9) unstable; urgency=low * converted to debhelper * code and Makefile cleanup * works under FreeBSD (thanks to Peter Rybár ) -- Radovan Garabik Tue, 4 May 1999 13:56:13 +0200 xtell (0.8) unstable; urgency=low * should not access utmp file directly, which makes everybody happy, and (hopefully) avoids the whole mess with different utmp structures for different (g)libc versions. -- Radovan Garabik Wed, 17 Mar 1999 10:09:43 +0100 xtell (0.7) unstable; urgency=low * Package debianized. * General code cleanup * Added --help and --version to xtell (as requested by PeHaSys) * No longer does empty line end sending messages - use ^D instead * does not use cuserid(3) anymore * Previous changes are: v0.6 - logging of messages added v0.5 - verbose mode added v0.4 - manual pages v0.3 - various fixes, does not required snprintf to compile v0.2 - fixed bug when printing % sign v0.1 - initial release -- Radovan Garabik Sun, 14 Mar 1999 21:16:48 +0100 Local variables: mode: debian-changelog End: xtell-2.10.7/debian/postinst0000644000000000000000000000167707370560712012671 0ustar #!/bin/sh -e # postinst for djbdns # written by Adam McKenna # #DEBCONF_DEBUG=1 #export DEBCONF_DEBUG case "$1" in configure) # continue below ;; abort-upgrade|abort-remove|abort-deconfigure) exit 0 ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 0 ;; esac umask 022 RET=true test -e /usr/share/debconf/confmodule && { . /usr/share/debconf/confmodule # db_version 2.0 db_get xtelld/from_inetd } if [ "$RET" = "false" ]; then FROMINETD="no" else FROMINETD="yes" fi /etc/init.d/xtell stop || true echo "FROMINETD=$FROMINETD" > /etc/xtelldrc if [ "$FROMINETD" = "no" ]; then update-inetd --remove '4224\t.*' update-inetd --remove 'xtell\t.*' else update-inetd --group OTHER --add "xtell stream tcp nowait xtelld.tty /usr/sbin/tcpd /usr/sbin/xtelld" fi /etc/init.d/xtell start || true #DEBHELPER# test -e /usr/share/debconf/confmodule && { db_stop } exit 0 xtell-2.10.7/debian/compat0000644000000000000000000000000211104664430012236 0ustar 4 xtell-2.10.7/debian/config0000644000000000000000000000025007264674120012236 0ustar #!/bin/sh -e action=$1 version=$2 # Source debconf library. . /usr/share/debconf/confmodule #db_version 2.0 db_input medium xtelld/from_inetd || true db_go #exit 0 xtell-2.10.7/debian/postrm0000644000000000000000000000013507264413110012305 0ustar #!/bin/sh # post install script for the Debian GNU/Linux xtell package set -e #DEBHELPER# xtell-2.10.7/debian/copyright0000644000000000000000000000022710357536675013016 0ustar This package was written by Radovan Garabík. Originally based on ident2 frm Michael Bacarella. Copyright: GPL (see /usr/share/common-licenses/GPL) xtell-2.10.7/debian/examples0000644000000000000000000000002407302537263012605 0ustar xtellreply write.sh xtell-2.10.7/debian/preinst0000644000000000000000000000240110357537741012461 0ustar #! /bin/sh # preinst script for netsaint # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' if [ -L /usr/bin/write ]; then rm -f /usr/bin/write fi if [ -L /usr/share/man/man1/write.1.gz ]; then rm -f /usr/share/man/man1/write.1.gz fi # if there was an old entry, remove it update-inetd --remove 'xtell\t.*' #dpkg-divert --package xtell --remove --rename \ # --divert /usr/bin/write.orig /usr/bin/write #dpkg-divert --package xtell --remove --rename \ # --divert /usr/share/man/man1/write.orig.1.gz /usr/share/man/man1/write.1.gz case "$1" in install|upgrade) if id xtelld >/dev/null 2>&1 ; then # We have a xtelld user. if [ `id xtelld -g -n` != "tty" ] ; then usermod -g tty xtelld fi else adduser --system --ingroup tty --no-create-home --home /tmp --quiet xtelld fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 xtell-2.10.7/debian/templates0000644000000000000000000000045707620217426012776 0ustar Template: xtelld/from_inetd Type: boolean Default: true _Description: Do you want xtell daemon to run from inetd? By default, xtelld runs from inetd. . However, you can run it as standalone daemon. If you select No, xtell daemon will be started automatically at boot time. . If unsure, select Yes xtell-2.10.7/common.c0000644000000000000000000000356607455104673011300 0ustar /* * ================================================================ * Please view: * * README for program information. * COPYING for distribution information. * * based on ident2 by Michael Bacarella (defile@nyct.net) * * ================================================================ */ #include "xtelld.h" #include #include #include /* ------------------------------------------------------------------ * get_request : a fgets for file descriptors * ------------------------------------------------------------------ */ short int get_request(int d, char buffer[], unsigned short int len) { unsigned short i; char ch; memset(buffer, 0, len); for (i = 0; i < len; i++) { if (read(d, &ch, 1) != 1) return -1; else if (ch == '\n') break; else if (ch == '\r') { read(d, &ch, 1); /* it better be \n */ break; } else buffer[i] = ch; } buffer[i] = '\0'; return i; } int logFILE(const char *fromluser) { int filedes; char *path; struct passwd *passs; struct stat s; if ((passs = getpwnam(fromluser)) != NULL) { path = malloc(strlen(passs->pw_dir) + sizeof(LOGFILE) + 1); if (path == NULL) return -1; strcpy(path, passs->pw_dir); strcat(path, "/"); strcat(path, LOGFILE); #ifdef O_NOFOLLOW if ((filedes = open(path, O_WRONLY | O_APPEND | O_NOFOLLOW)) != -1) { #else if ((filedes = open(path, O_WRONLY | O_APPEND)) != -1) { #endif if (fstat(filedes, &s) == 0) { if (S_ISREG(s.st_mode)) { free(path); return filedes; } } } free(path); } return -1; } /* ------------------------------------------------------------------ * killsock: * violently kills a socket * ------------------------------------------------------------------ */ void killsock(int s) { shutdown(s, 2); close(s); } xtell-2.10.7/config.h0000644000000000000000000000174607620222074011246 0ustar /* Port to bind to. */ #define XTELL_DEFAULT_PORT 4224 #define USE_READLINE #define USE_LIBIDENT #ifdef USE_READLINE # include "/usr/include/readline/history.h" # include "/usr/include/readline/readline.h" #endif #ifdef USE_LIBIDENT # include "/usr/include/ident.h" #endif /* if your system does not have getutent & comp., comment out this */ /* BSD clones usually do not have */ #define HAVE_GETUTENT /* define this for linux 2.2 and above (for O_NOFOLLOW flag) */ #define __USE_GNU /* if you are compiling for Cygwin, uncomment this */ /* #define CYGWIN */ /* you probably need not touch variables below */ #define MAX_MSG_LENGTH 1024 #define MAX_LUSERNAME_LENGTH 20 #define MAX_TTY_LENGTH 8 #define MAX_HOSTNAME 255 #define MAX_SOCK_LENGTH (MAX_MSG_LENGTH+MAX_LUSERNAME_LENGTH*2+MAX_TTY_LENGTH+5+2) #define MAX_REPLY_LENGTH 50 #define MAX_TIME_LENGTH 20 #define TTYDIR "/dev/" #define VERSION "2.10" #define LOGFILE ".xtell-log" /* #define USE_CUSERID */ xtell-2.10.7/AUTHORS0000644000000000000000000000006307153652401010671 0ustar Radovan Garabik xtell-2.10.7/xtelld.80000644000000000000000000000337210304630034011202 0ustar .TH XTELLD 8 .SH NAME xtelld \- daemon receiving messages from xtell(1) clients .SH SYNOPSIS .B xtelld .BI "[options]" .SH DESCRIPTION xtelld is daemon receiving messages from the xtell(1) client and displaying them to apropriate user. .SH OPTIONS .TP .I "\-\-help" Short help .TP .I "\-\-alone" Force server to run standalone .TP .I "\-\-inetd" Force server to act as service of inetd .TP .I "\-\-version" Print version information and exit. .TP .I "\-sX" Lifetime for spawned services (in seconds) ex: \-s25 maintain connections for up to 25 seconds .TP .I "\-mX" Spawn no more than X children services at a time ex: \-m15 service no more than 15 requests at once. Note: ignored if inetd service .TP .I "\-pX" Use port X, default: 4224 .TP .I "\-n" Do not lookup addresses, use IP numbers instead .SH USAGE Xtell daemon can run either from inetd(preferred) or from command line. If you decide to start it from inetd, add this line to /etc/services : xtell 4224/tcp # xtell server and this line to /etc/inetd.conf : xtell stream tcp nowait nobody.tty /usr/sbin/tcpd /usr/local/sbin/xtelld Notice that the entries are separated by tabs, not spaces. Restart inetd with killall \-HUP inetd What to do if you are a normal user and want to run xtell daemon: You can't run it from inetd, obviously. Just start ./xtelld to use xtell on default port (4224). In this case, xtell can write messages only to you. If there is another user on that system willing to get messages, either s/he starts xtelld on another port (e.g. ./xtelld \-p4225), or makes his/her tty writable by you (e.g. chmod a+rw /dev/tty* /dev/pts/*) .SH AUTHOR Radovan Garab\('ik (garabik@fmph.uniba.sk) .SH "SEE ALSO" .BR xtell "(1), .BR write "(1), .BR talk "(1), .BR talkd "(8), .BR tty "(1) xtell-2.10.7/xtelld.c0000644000000000000000000001143007265677765011311 0ustar /* * ================================================================ * Please view: * * README for program information. * COPYING for distribution information. * * based on ident2 by Michael Bacarella (defile@nyct.net) * * ================================================================ */ #include "xtelld.h" /* ------------------------------------------------------------------ * client_reply: * send a reply back to the client.. * ------------------------------------------------------------------ */ void client_reply(int sd, char *outcome) { char buffer[1024]; sprintf(buffer, "%s\r\n", outcome); write(sd, buffer, strlen(buffer)); } /* ============================================================================ LOCAL FUNCTIONS ============================================================================ */ /* ------------------------------------------------------------------ * is_inetd_child: * determine if we're running as a child of inetd * or if we were started via a command line (or forked and * exec'd from a process not inetd) * ------------------------------------------------------------------ */ #ifdef CYGWIN /* under CYGWIN, xtelld has to be run as daemon, and autodetection does not work.... */ static int is_inetd_child(void) { return 0; } #else static int is_inetd_child(void) { struct sockaddr_in sin; int sinsize; sinsize = sizeof(struct sockaddr_in); /* if child of inetd, stdin (0) would be a socket */ if (getsockname(0, (struct sockaddr *) &sin, &sinsize) == -1) { if (errno == ENOTSOCK) return 0; else { /* this is a serious error, crap! */ perror("getsockname"); /* print to stderr as well */ syslog(LOG_ERR, "getsockname: %s\n", strerror(errno)); exit(-1); } } return 1; } #endif /* ------------------------------------------------------------------ * usage: * ------------------------------------------------------------------ */ static void usage(char *progname) { fprintf(stderr, "usage: %s [options]\n" " --help This information\n" " -?\n" " --alone Force server to run standalone\n" " --inetd Force server to act as service of inetd\n" " --version Print version information and exit.\n" " -v\n" " -sX Lifetime for spawned services (in seconds)\n" " ex: -s25 maintain connections for up to 25 seconds\n" " -mX Spawn no more than X children services at a time\n" " ex: -m15 service no more than 15 requests at once\n" " note: ignored if inetd service\n" " -pX Use port X\n" " default: 4224\n" " -n Do not lookup addresses, use IP numbers instead\n", progname); exit(0); } /* ------------------------------------------------------------------ * print_version: * wouldn't want to disappoint anyone. * ------------------------------------------------------------------ */ static void print_version(void) { fprintf(stderr, "xtell %s\n", VERSION); exit(0); } /* ================================================================== * -- MAIN -- * execution can take two major paths. * it can transform this process into a daemon, which binds to the * auth port and services requests by forking.. * ..or it will become a simple one shot inetd service handler. * ================================================================== */ int main(int argc, char *argv[]) { u_short i; char inetd_child = 0, stand_alone = 0; client_timeout = 3600; /* 1 hour - should be more than enough */ max_connections = 10; resolve_addr = 1; xtell_port = XTELL_DEFAULT_PORT; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 's': client_timeout = atoi(argv[i] + 2); break; case 'm': max_connections = atoi(argv[i] + 2); break; case 'p': xtell_port = atoi(argv[i] + 2); break; case 'v': print_version(); case 'n': resolve_addr = 0; break; case '?': usage(argv[0]); case '-': if (strncmp("inetd", (argv[i] + 2), 5) == 0) inetd_child = 1; else if (strncmp("alone", (argv[i] + 2), 5) == 0) stand_alone = 1; else if (strncmp("version", (argv[i] + 2), 7) == 0) print_version(); else if (strcmp("help", (argv[i] + 2)) == 0) usage(argv[0]); break; } } } /* if nothing is forced... */ if (stand_alone == 0 && inetd_child == 0) { if (is_inetd_child()) /* ...try to determine automagically */ inetd_child = 1; } if (inetd_child) { openlog("in.xtell", LOG_PID, LOG_AUTH); alarm(client_timeout); signal(SIGALRM, xtell_killtic); inetd_service(0, 1); killsock(0); killsock(1); closelog(); } else daemon_service(); exit(-1); } xtell-2.10.7/xtelld.h0000644000000000000000000000336607455100721011275 0ustar /* =================================================================== * xtelld.h * * * ================================================================ */ #ifndef XTELL_H_ #define XTELL_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" /* ================================================================== * GLOBALS * ================================================================== */ /* SERVICE BEHAVIOR */ unsigned char resolve_addr; /* reverse lookup addresses */ unsigned short max_connections; /* maximum number of open connections */ unsigned short client_timeout; /* number of seconds till disconnect */ unsigned int xtell_port; /* ================================================================== * PROTOTYPES: * ================================================================== */ /* #### XTELLD.C #### */ void killsock (int); int get_ports (char[], u_short *, u_short *); void client_reply (int, char *); /* #### CHILD.C #### */ extern void xtell_killtic (int); extern void inetd_child (int, int); void inetd_service (int sd_in, int sd_out); /* #### DAEMON.C #### */ void daemon_service (void); /* #### TTY.C #### */ int parse_and_write(char *s, char *identity, char *addr, unsigned int msgcount); /* commonn.c */ int logFILE(const char *fromluser); short int get_request (int d, char buffer[], unsigned short int len); #ifdef BEOS # define PF_INET AF_INET #endif #endif /* WHOLE FILE */ xtell-2.10.7/CHANGES0000777000000000000000000000000011317444555013714 2debian/changelogustar xtell-2.10.7/write.sh0000755000000000000000000000034707446702576011335 0ustar #!/bin/sh if [ "$#" != "1" -a "$#" != "2" ]; then echo 'Usage: write user [tty]' echo 'or: xtell user[:tty]@fqdn' exit 0 fi user=$1 tty=$2 if [ "$tty" = "" ]; then arg=$user else arg=$user:$tty fi exec xtell $arg xtell-2.10.7/COPYING0000644000000000000000000004311407153652401010660 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xtell-2.10.7/daemon.c0000644000000000000000000000751007305525034011234 0ustar /* ================================================================== * DAEMON.C * * This file provides the 'daemon' implementation of * xtell. * * * Daemon- * Regular daemon which waits for connections * forks, handles connections, cleans up, * dies, etc. * * =============================================================== */ #include "xtelld.h" /* the entry point is daemon_service (last function, at the bottom) */ unsigned long open_connections; /* ------------------------------------ * child_reaper: * free resources of child service * as well as close the descriptor * on the parent end * ------------------------------------ */ static void child_reaper (int s) { int status; wait (&status); if (WIFEXITED(status)) /* exit value is a socket descriptor */ killsock (WEXITSTATUS(status)); signal (SIGCHLD, child_reaper); if (open_connections > 0) open_connections--; } /* ------------------------------------------------------------------ * daemon_core: * this maintains a standalone -forking- daemon * it basically waits for a connection, forks off * a handler for it, and cleans up when it dies. * results in much smaller code, but also a wee bit more * overhead. * ------------------------------------------------------------------ */ static void daemon_core (int sd) { struct sockaddr_in sin; int sinsize, sd_peal; sinsize = sizeof (struct sockaddr); signal (SIGCHLD, child_reaper); while (1) { sd_peal = accept (sd, (struct sockaddr *)&sin, &sinsize); if (sd_peal == -1) { if (errno == EINTR) continue; else break; } else if (open_connections < max_connections) { switch (fork ()) { case 0: alarm (client_timeout); signal (SIGALRM, xtell_killtic); /* we trick the inetd service handler into * thinking it was spawned by inetd, rather * than this process. harmless prank. */ inetd_service (sd_peal, sd_peal); killsock (sd_peal); exit (sd_peal); case -1: fprintf(stderr, "daemon_service: could not fork!!\n"); syslog(LOG_ERR, "daemon_service: could not fork!!"); break; default: open_connections++; break; } } else killsock (sd_peal); } fprintf(stderr, "accept() returned error: %s\n", strerror (errno)); syslog(LOG_ERR, "accept() returned error: %s", strerror (errno)); } /* ------------------------------------------------------------------ * daemon_service : * ------------------------------------------------------------------ */ void daemon_service (void) { int sd, err; struct sockaddr_in sin; open_connections = 0; openlog ("xtell", LOG_PID, LOG_AUTH); setsid (); if (fork ()) /* daemonize */ exit (0); chdir ("/"); sd = socket (PF_INET, SOCK_STREAM, 0); if (sd == -1) { syslog(LOG_ERR, "Cannot allocate socket: %s", strerror (errno)); fprintf(stderr, "Cannot allocate socket: %s\n", strerror (errno)); exit (-1); } sin.sin_family = AF_INET; sin.sin_port = htons (xtell_port); sin.sin_addr.s_addr = INADDR_ANY; err = bind (sd, (struct sockaddr *)&sin, sizeof (sin)); if (err == -1) { syslog(LOG_ERR, "Cannot bind to port %d: %s", xtell_port, strerror (errno)); fprintf(stderr, "Cannot bind to port %d: %s\n", xtell_port, strerror (errno)); exit (-1); } if (-1 == listen (sd, 5)) { syslog(LOG_ERR, "Cannot listen on port %d: %s", xtell_port, strerror (errno)); fprintf(stderr, "Cannot listen on port %d: %s\n", xtell_port, strerror (errno)); exit (-1); } syslog (LOG_NOTICE, "xtell services started [ %s ]", VERSION); daemon_core (sd); syslog(LOG_ERR, "xtell services terminated (exiting on internal error)"); fprintf(stderr, "xtell services terminated (exiting on internal error)\n"); closelog (); killsock (sd); } xtell-2.10.7/child.c0000644000000000000000000000713707446664270011075 0ustar /* ================================================================== * CHILD.C * ------- * * This module is responsible for running * xtell as a child service of inetd. * It cares for this child like a good parent should, * providing vital nutrients, love, support, child * reapers, and built in functionality to have the * child kill itself if it stays alive too long. * * ================================================================== */ #include "xtelld.h" #ifndef USE_LIBIDENT # define ident_id(a,b) NULL #endif static int s_in = -1, s_out = -1; /* ------------------------------------------------------------------ * lookup_addr: * if resolve_addr, try to reverse resolve the address. * else return the numerical ip. * else return the numerical ip. * ------------------------------------------------------------------ */ static char *lookup_addr(struct in_addr in) { static char addr[MAX_HOSTNAME]; struct hostent *he; if (resolve_addr) { he = gethostbyaddr((char *) &in, sizeof(struct in_addr), AF_INET); if (he == NULL) strncpy(addr, inet_ntoa(in), sizeof(addr)); else strncpy(addr, he->h_name, sizeof(addr)); } else strncpy(addr, inet_ntoa(in), sizeof(addr)); addr[sizeof(addr)-1] = '\0'; return addr; } /* ---------------------------------------------------------------- * killtic: * kill this process after a pre-determined * timeout period. (SIGALRM handler) * ---------------------------------------------------------------- */ void xtell_killtic(int s) { killsock(s_in); killsock(s_out); exit(0); } /* ------------------------------------------------------------------ * inetd_service: * this function does the actual pipe handling * user lookups, replies, etcetera. if called * by the daemon, sd_in and sd_out will be * the same descriptor, if a child of inetd, * sd_in will be stdin, sd_out will be stdout * ------------------------------------------------------------------ */ void inetd_service(int sd_in, int sd_out) { struct in_addr laddr, raddr; struct sockaddr_in sin; char buffer[MAX_SOCK_LENGTH]; int sinsize = sizeof(struct sockaddr_in); short int reqstat; unsigned int msgcount; char *identid = NULL; s_in = sd_in; s_out = sd_out; if (getpeername(sd_in, (struct sockaddr *) &sin, &sinsize) == -1) { syslog(LOG_NOTICE, "error: getpeername: %s", strerror(errno)); client_reply(sd_out, "401 getpeername failed"); return; /* the error implies the net is down, but try */ } raddr = sin.sin_addr; if (getsockname(sd_in, (struct sockaddr *) &sin, &sinsize) == -1) { syslog(LOG_ERR, "error: getsockname: %s", strerror(errno)); client_reply(sd_out, "402 getsockname failed"); return; } laddr = sin.sin_addr; msgcount = 0; while (1) { reqstat = get_request(sd_in, buffer, MAX_SOCK_LENGTH); alarm(client_timeout); /* and reset timeout counter */ if ((reqstat < 0) || (!strncasecmp(buffer, "quit", 4))) break; if (msgcount == 0) identid = ident_id(sd_in, 5); if (reqstat) { switch (parse_and_write(buffer, identid, lookup_addr(raddr), ++msgcount)) { case 0: client_reply(sd_out, "200 OK, sent."); break; /* OK */ case -1: client_reply(sd_out, "403 User is not here."); break; /* not logged in */ case -2: client_reply(sd_out, "404 User does not want you."); break; /* not logged in */ case -3: client_reply(sd_out, "405 Cannot write to that user's tty."); break; /* mesg n or bad tty given */ case -4: client_reply(sd_out, "406 Ehhh, what?"); break; /* other error */ } } } }