--- rstatd-4.0.1.orig/rstat_main.c +++ rstatd-4.0.1/rstat_main.c @@ -83,8 +83,8 @@ int main(int argc, char **argv) { SVCXPRT *transp; - int fromlen, sock = 0, proto = 0; struct sockaddr_in from; + int fromlen = sizeof from, sock = 0, proto = 0; int count = 1; if (argc > 1) { --- rstatd-4.0.1.orig/rsysinfo.c +++ rstatd-4.0.1/rsysinfo.c @@ -95,7 +95,7 @@ printf("System Information for: %s\n",host); - printf("uptime: %s%sload averge: %.2f %.2f %.2f\n", + printf("uptime: %s%sload average: %.2f %.2f %.2f\n", days_buf, hours_buf, host_stat->avenrun[0]/256.0, host_stat->avenrun[1]/256.0, host_stat->avenrun[2]/256.0); --- rstatd-4.0.1.orig/rup.c +++ rstatd-4.0.1/rup.c @@ -25,6 +25,7 @@ * **************************************************************************/ +#include #include #include #include @@ -79,6 +80,42 @@ return(0); } +static void convuptime( + long host_uptime, char *days_buf, size_t days_len, char *hours_buf +) { + int hours, mins; + long days; + + *days_buf = 0; + *hours_buf = 0; + + if (host_uptime <= 0) { + return; + } + + host_uptime = (host_uptime + 59) / 60; + mins = host_uptime % 60; + host_uptime /= 60; + hours = host_uptime % 24; + days = host_uptime / 24; + + if (days) { + snprintf( + days_buf, days_len, "%3ld day%s, ", + days, (days > 1) ? "s" : "" + ); + } + + if (hours) { + sprintf(hours_buf, "%2d:%02d, ", hours, mins); + } else if (mins) { + sprintf( + hours_buf, "%2d min%s, ", mins, + (mins > 1) ? "s" : "" + ); + } +} + int rup_answer_v5(struct statsusers *replyp, struct sockaddr_in *raddrp) { struct tm *tmp_time; @@ -86,9 +123,10 @@ char *host; struct statsusers *host_stat; struct tm host_time; - struct tm host_uptime; char days_buf[16]; char hours_buf[16]; + char users_buf[16]; + long host_uptime; if(find_hostname(raddrp->sin_addr)) { return(0); @@ -105,36 +143,20 @@ else host = (char *)inet_ntoa(raddrp->sin_addr); - if (strlen(host) > 12) - host[12] = '\0'; - tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec); host_time = *tmp_time; - host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec; - - tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec); - host_uptime = *tmp_time; - - - if (host_uptime.tm_yday != 0) - sprintf(days_buf, "%3d day%s, ", host_uptime.tm_yday, - (host_uptime.tm_yday > 1) ? "s" : ""); - else - days_buf[0] = '\0'; - - if (host_uptime.tm_hour != 0) - sprintf(hours_buf, "%2d:%02d, ", - host_uptime.tm_hour, host_uptime.tm_min); - else - if (host_uptime.tm_min != 0) - sprintf(hours_buf, "%2d mins, ", host_uptime.tm_min); - else - hours_buf[0] = '\0'; - - printf("%-*s up %9.9s%9.9s%i users, load average: %.2f %.2f %.2f\n", - 12,host,days_buf,hours_buf, - host_stat->users, + convuptime( + host_stat->curtime.tv_sec - host_stat->boottime.tv_sec, + days_buf, sizeof(days_buf), hours_buf + ); + + sprintf(users_buf, "%3d user%s, ", host_stat->users, + (host_stat->users > 1) ? "s" : ""); + + printf("%-*.*s %2d:%02d up %10.10s%9.9s%11.11sload %.2f %.2f %.2f\n", + 21, 21, host, host_time.tm_hour, host_time.tm_min, + days_buf, hours_buf, users_buf, (double)host_stat->avenrun[0]/FSCALE, (double)host_stat->avenrun[1]/FSCALE, (double)host_stat->avenrun[2]/FSCALE); @@ -150,9 +172,9 @@ char *host; struct statstime *host_stat; struct tm host_time; - struct tm host_uptime; char days_buf[16]; char hours_buf[16]; + long host_uptime; if(find_hostname(raddrp->sin_addr)) { return(0); @@ -169,35 +191,17 @@ else host = (char *)inet_ntoa(raddrp->sin_addr); - if (strlen(host) > 12) - host[12] = '\0'; - tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec); host_time = *tmp_time; - host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec; - - tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec); - host_uptime = *tmp_time; - - - if (host_uptime.tm_yday != 0) - sprintf(days_buf, "%3d day%s, ", host_uptime.tm_yday, - (host_uptime.tm_yday > 1) ? "s" : ""); - else - days_buf[0] = '\0'; - - if (host_uptime.tm_hour != 0) - sprintf(hours_buf, "%2d:%02d, ", - host_uptime.tm_hour, host_uptime.tm_min); - else - if (host_uptime.tm_min != 0) - sprintf(hours_buf, "%2d mins, ", host_uptime.tm_min); - else - hours_buf[0] = '\0'; - - printf("%-*s up %9.9s%9.9s load average: %.2f %.2f %.2f\n", - 12,host,days_buf,hours_buf, + convuptime( + host_stat->curtime.tv_sec - host_stat->boottime.tv_sec, + days_buf, sizeof(days_buf), hours_buf + ); + + printf("%-*.*s %2d:%02d up %10.10s%9.9sload %.2f %.2f %.2f\n", + 21, 21, host, host_time.tm_hour, host_time.tm_min, + days_buf, hours_buf, (double)host_stat->avenrun[0]/FSCALE, (double)host_stat->avenrun[1]/FSCALE, (double)host_stat->avenrun[2]/FSCALE); @@ -306,7 +310,7 @@ } void usage() { - printf("usage: %s \"host\" -u -v\n"\ + printf("usage: %s {-u | -v | hosts ...}\n"\ "\t-u\tbroadcast request for info including users.\n"\ "\t-v\tprint version and exit\n", program_name); } @@ -341,20 +345,23 @@ exit(0); } - if((hp = gethostbyname(argv[1])) == NULL) { - fprintf(stderr,"%s: cannot get hostname %s\n",program_name,argv[1]); - exit(-1); - } - - bcopy(hp->h_addr,(caddr_t)&server_addr.sin_addr, hp->h_length); - server_addr.sin_family = AF_INET; - server_addr.sin_port = 0; - - if(pointopoint_v5(&server_addr) == 1) - exit(EXIT_SUCCESS); - else if(pointopoint_v3(&server_addr) == 1) - exit(EXIT_SUCCESS); + for (; optind < argc; optind++) { + if((hp = gethostbyname(argv[optind])) == NULL) { + fprintf(stderr,"%s: cannot get hostname %s\n",program_name,argv[optind]); + continue; + } + + bcopy(hp->h_addr,(caddr_t)&server_addr.sin_addr, hp->h_length); + server_addr.sin_family = AF_INET; + server_addr.sin_port = 0; + + if(pointopoint_v5(&server_addr) == 1) + continue; + else if(pointopoint_v3(&server_addr) == 1) + continue; + else + clnt_pcreateerror(program_name); + } - clnt_pcreateerror(program_name); - exit(EXIT_FAILURE); + return 0; } --- rstatd-4.0.1.orig/rup.1 +++ rstatd-4.0.1/rup.1 @@ -3,7 +3,7 @@ .SH NAME rup \- remote uptime display .SH SYNOPSIS -\fBrup\fP [ \fIhost\fP | -u | -v ] +\fBrup\fP { -u | -v | \fIhosts\fP ... } .SH DESCRIPTION \fBrup\fP displays a summary of the current status of a particular host or all hosts on the local network. @@ -43,7 +43,7 @@ .SH SEE ALSO \fBportmap(8)\fP, \fBrpc.rstatd(8)\fP, \fBinetd(8)\fP .SH HISTORY -The \fBrup\fP command appeared in \fBSun-OS\fP. +The \fBrup\fP command appeared in \fBSunOS\fP. .SH BUGS The sorting options are not implemented. .SH AUTHOR --- rstatd-4.0.1.orig/debian/changelog +++ rstatd-4.0.1/debian/changelog @@ -0,0 +1,99 @@ +rstatd (4.0.1-2) unstable; urgency=low + + * The namelen parameter should be initialized to indicate the + amount of space pointed to by name. Closes: #363641, #324551, + #336588. Patch by Pete Harlan . + + -- Anibal Monsalve Salazar Mon, 16 Oct 2006 20:07:14 +1000 + +rstatd (4.0.1-1) unstable; urgency=low + + * New upstream release. + * Set Standards-Version to 3.7.2. + * Set DH_COMPAT to 5. + * Fixed "diff-contains-substvars debian/substvars". + + -- Anibal Monsalve Salazar Tue, 04 Jul 2006 19:50:05 +1000 + +rstatd (4.0-1) unstable; urgency=low + + * New upstream release. + * Set Standards-Version to 3.6.2 added homepage to description. + * Fixed lintian warning "package-uses-deprecated-debhelper-compat- + version 1". + * Added watch file. + * Updated FSF mail address. + + -- Anibal Monsalve Salazar Sun, 27 Nov 2005 18:17:50 +1100 + +rstatd (3.07-4) unstable; urgency=low + + * New maintainer's email address. + + -- Anibal Monsalve Salazar Thu, 10 Feb 2005 20:19:28 +1100 + +rstatd (3.07-3) unstable; urgency=low + + * New maintainer. + + -- Anibal Monsalve Salazar Thu, 20 May 2004 10:18:17 +1000 + +rstatd (3.07-2) unstable; urgency=low + + * Dropped libc6-dev build-dependency. + + -- Herbert Xu Fri, 13 Jun 2003 23:15:43 +1000 + +rstatd (3.07-1) unstable; urgency=low + + * New upstream release (closes: #195794). + * Updated upstream location. + + -- Herbert Xu Mon, 9 Jun 2003 15:23:09 +1000 + +rstatd (3.03-7) unstable; urgency=low + + * Added libc6-dev to build-time dependency for rpcgen (closes: #108179). + + -- Herbert Xu Fri, 10 Aug 2001 07:30:19 +1000 + +rstatd (3.03-6) unstable; urgency=low + + * Fixed the "year" bug for both v3 and v5 (closes: #92587). + + -- Herbert Xu Sat, 14 Apr 2001 14:42:07 +1000 + +rstatd (3.03-5) unstable; urgency=low + + * Uptimes greater than a year is now displayed correctly (closes: #92587). + * FHS compliance adjustments (closes: #91039, #91059). + + -- Herbert Xu Tue, 3 Apr 2001 21:50:46 +1000 + +rstatd (3.03-4) unstable; urgency=low + + * Depend on portmap (closes: #72093, #72742). + * Added build-time dependencies. + * Fixed spelling error in rsysinfo (closes: #72734). + + -- Herbert Xu Fri, 29 Sep 2000 11:49:50 +1100 + +rstatd (3.03-3) unstable; urgency=low + + * Restrict the output to 80 columns (closes: #62168). + * Support multiple hosts on the command line (closes: #56486). + + -- Herbert Xu Wed, 12 Apr 2000 17:50:05 +1000 + +rstatd (3.03-2) frozen unstable; urgency=low + + * Changed Sun-OS to SunOS in rup(1) (closes: #56488). + + -- Herbert Xu Mon, 20 Mar 2000 08:45:23 +1100 + +rstatd (3.03-1) unstable; urgency=low + + * Initial Release (fixes #44886). + + -- Herbert Xu Sun, 5 Sep 1999 19:08:21 +1000 + --- rstatd-4.0.1.orig/debian/control +++ rstatd-4.0.1/debian/control @@ -0,0 +1,26 @@ +Source: rstatd +Section: net +Priority: optional +Maintainer: Anibal Monsalve Salazar +Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 5) + +Package: rstatd +Architecture: any +Depends: netbase, portmap | netbase (<< 4.00), ${shlibs:Depends}, ${misc:Depends} +Replaces: netstd +Description: displays uptime information for remote machines + This allows other machines on your local network to get information about + your computer - especially uptime. This will allow you to use the rup(1) + command. + . + Homepage: http://rstatd.sourceforge.net/ + +Package: rstat-client +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: netstd +Description: client for rstatd + This package contains rup(1) and rsysinfo(1), clients for rstatd. + . + Homepage: http://rstatd.sourceforge.net/ --- rstatd-4.0.1.orig/debian/rules +++ rstatd-4.0.1/debian/rules @@ -0,0 +1,75 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Copyright (C) 2004-2005 Anibal Monsalve Salazar + +export DH_VERBOSE=1 +export DH_COMPAT=5 + +configure: configure-stamp +configure-stamp: + dh_testdir + + ./configure --prefix=/usr + + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp install-stamp configure-stamp + rm -fr CVS + + -$(MAKE) distclean + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cp rpc.rstatd debian/rstatd/usr/sbin + cp rstatd.8 debian/rstatd/usr/share/man/man8/rpc.rstatd.8 + cp rup rsysinfo debian/rstat-client/usr/bin + cp rup.1 rsysinfo.1 debian/rstat-client/usr/share/man/man1 + + 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_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installmenu + dh_installcron + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + 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 install configure --- rstatd-4.0.1.orig/debian/copyright +++ rstatd-4.0.1/debian/copyright @@ -0,0 +1,58 @@ +This package was debianised by Herbert Xu herbert@debian.org on +Wed, 15 Sep 1999 14:39:40 +1000. + +It is maintained by Anibal Monsalve Salazar . + +It was downloaded from http://sourceforge.net/projects/rstatd/. + +Copyright: + +rstat.x: + +Sun RPC is a product of Sun Microsystems, Inc. and is provided for +unrestricted use provided that this legend is included on all tape +media and as a part of the software program in whole or part. Users +may copy or modify Sun RPC without charge, but are not authorized +to license or distribute it to anyone else except as part of a product or +program developed by the user. + +SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + +Sun RPC is provided with no support and without any obligation on the +part of Sun Microsystems, Inc. to assist in its use, correction, +modification or enhancement. + +SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +OR ANY PART THEREOF. + +In no event will Sun Microsystems, Inc. be liable for any lost revenue +or profits or other special, indirect and consequential damages, even if +Sun has been advised of the possibility of such damages. + +Sun Microsystems, Inc. +2550 Garcia Avenue +Mountain View, California 94043 + +Modifications to rstat.x and the rest: + +Copyright (C) 1995 Adam Migus, Memorial University of Newfoundland + +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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +The license can be found in /usr/share/common-licenses/GPL. + --- rstatd-4.0.1.orig/debian/dirs +++ rstatd-4.0.1/debian/dirs @@ -0,0 +1,2 @@ +usr/share/man/man8 +usr/sbin --- rstatd-4.0.1.orig/debian/docs +++ rstatd-4.0.1/debian/docs @@ -0,0 +1 @@ +README --- rstatd-4.0.1.orig/debian/watch +++ rstatd-4.0.1/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://prdownloads.sourceforge.net/rstatd/rpc.rstatd-(.*).tar.gz debian uupdate --- rstatd-4.0.1.orig/debian/postinst +++ rstatd-4.0.1/debian/postinst @@ -0,0 +1,22 @@ +#!/bin/sh -e +# $Id: postinst,v 1.1 1999/09/17 05:42:11 herbert Exp $ + +case "$1" in +abort-upgrade | abort-deconfigure | abort-remove) + update-inetd --enable rstatd + ;; +configure) + if [ -n "$2" ]; then + update-inetd --enable rstatd + else + update-inetd --remove "rstatd/1-3 dgram rpc/udp wait root /usr/sbin/tcpd /usr/sbin/rpc.rstatd" + update-inetd --group RPC --add "rstatd/1-5 dgram rpc/udp wait nobody /usr/sbin/tcpd /usr/sbin/rpc.rstatd" + fi + ;; +*) + printf "$0: incorrect arguments: $*\n" >&2 + exit 1 + ;; +esac + +#DEBHELPER# --- rstatd-4.0.1.orig/debian/postrm +++ rstatd-4.0.1/debian/postrm @@ -0,0 +1,19 @@ +#!/bin/sh -e +# $Id: postrm,v 1.1 1999/09/17 05:42:11 herbert Exp $ + +case "$1" in +abort-install | remove | abort-upgrade | upgrade | failed-upgrade | disappear) + ;; +purge) + # If netbase is not installed, then we don't need to do the remove. + if command -v update-inetd >/dev/null 2>&1; then + update-inetd --remove "rstatd .* /usr/sbin/rpc.rstatd" + fi + ;; +*) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; +esac + +#DEBHELPER# --- rstatd-4.0.1.orig/debian/prerm +++ rstatd-4.0.1/debian/prerm @@ -0,0 +1,9 @@ +#!/bin/sh -e +# $Id: prerm,v 1.1 1999/09/17 05:42:11 herbert Exp $ + +# If netbase is not installed, then we don't need to do the remove. +if command -v update-inetd >/dev/null 2>&1; then + update-inetd --disable rstatd +fi + +#DEBHELPER# --- rstatd-4.0.1.orig/debian/source.lintian-overrides +++ rstatd-4.0.1/debian/source.lintian-overrides @@ -0,0 +1 @@ +rstatd source: source-contains-CVS-dir CVS --- rstatd-4.0.1.orig/debian/rstat-client.dirs +++ rstatd-4.0.1/debian/rstat-client.dirs @@ -0,0 +1,2 @@ +usr/bin +usr/share/man/man1