#45944 slattach fails to check many errors

Package:
net-tools
Source:
net-tools
Description:
NET-3 networking toolkit
Submitter:
Ian Jackson
Date:
2005-07-18 03:33:56 UTC
Severity:
wishlist
#45944#5
Date:
1999-09-25 00:34:48 UTC
From:
To:
slattach fails to check the error return from nearly every significant
system call it makes.  Or rather, it checks the error return, prints a
message if the call failed, but then blithely carries on and will
eventually return a zero exit status !

I enclose a patch which fixes one of the most egregious cases, in
which if slattach failed to change the interface line discipline (ie,
failed to do its job at all) then it would not only appear to its
caller to succeed, but would print garbage for the interface name !

However, this program clearly needs a complete overhaul.  The
author(s) should not be proud of themselves.

I've marked this as `Severity: important' because given the
availability of the patch below which doesn't break the program any
worse than it already is, the patch should definitely be applied.  I'm
not saying that the program should be overhauled (rewritten?) before
the next release.

However, I'd appreciate it if this bug was left open until a review
has been done.  So, when you apply my patch, please downgrade the
severity of this report to `normal'.

This patch is in addition to the patch in my previous bug report,
which fixes some unrelated problems.

Thanks,
Ian.
--- slattach.c.orig2	Sun Sep 19 19:35:56 1999
+++ slattach.c	Sat Sep 25 01:24:50 1999
@@ -692,12 +692,12 @@
   /* Start the correct protocol. */
   if (ht == NULL) {
 	tty_sdisc = N_TTY;
-	tty_close();
+	tty_close(); /* fixme: errors are not checked ! */
 	return(0);
   }
   (*ht->activate)(tty_fd);
   if (opt_v == 1) {
-	tty_get_name(buff);
+	if (tty_get_name(buff) != 0) return(3);
 	printf(_("%s started"), proto);
 	if (path_dev != NULL) printf(_(" on %s"), path_dev);
 	printf(_(" interface %s\n"), buff);