summaryrefslogtreecommitdiffstats
path: root/gnu/libexec/uucp/uucico/uucico.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/libexec/uucp/uucico/uucico.c')
-rw-r--r--gnu/libexec/uucp/uucico/uucico.c112
1 files changed, 77 insertions, 35 deletions
diff --git a/gnu/libexec/uucp/uucico/uucico.c b/gnu/libexec/uucp/uucico/uucico.c
index 8183980..4044a31 100644
--- a/gnu/libexec/uucp/uucico/uucico.c
+++ b/gnu/libexec/uucp/uucico/uucico.c
@@ -1,7 +1,7 @@
/* uucico.c
This is the main UUCP communication program.
- Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994, 1995 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -17,16 +17,16 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
+ c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char uucico_rcsid[] = "$Id: uucico.c,v 1.3 1994/05/25 20:14:52 ache Exp $";
+const char uucico_rcsid[] = "$Id: uucico.c,v 1.190 1995/06/29 19:35:59 ian Rel $";
#endif
#include <ctype.h>
@@ -95,7 +95,10 @@ static const struct sprotocol asProtocols[] =
ffsenddata, ffwait, fffile },
{ 'v', UUCONF_RELIABLE_EIGHT, 1, TRUE,
asGproto_params, fvstart, fgshutdown, fgsendcmd, zggetspace,
- fgsenddata, fgwait, NULL }
+ fgsenddata, fgwait, NULL },
+ { 'y', UUCONF_RELIABLE_RELIABLE | UUCONF_RELIABLE_EIGHT, 1, TRUE,
+ asYproto_params, fystart, fyshutdown, fysendcmd, zygetspace,
+ fysenddata, fywait, fyfile }
};
#define CPROTOCOLS (sizeof asProtocols / sizeof asProtocols[0])
@@ -161,8 +164,9 @@ static void uapply_proto_params P((pointer puuconf, int bproto,
static boolean fsend_uucp_cmd P((struct sconnection *qconn,
const char *z));
static char *zget_uucp_cmd P((struct sconnection *qconn,
- boolean frequired));
-static char *zget_typed_line P((struct sconnection *qconn));
+ boolean frequired, boolean fstrip));
+static char *zget_typed_line P((struct sconnection *qconn,
+ boolean fstrip));
/* Long getopt options. */
static const struct option asLongopts[] =
@@ -333,7 +337,7 @@ main (argc, argv)
else
uusage ();
break;
-
+
case 's':
/* Set system name */
zsystem = optarg;
@@ -386,7 +390,7 @@ main (argc, argv)
case 'v':
/* Print version and exit. */
- printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n",
+ printf ("%s: Taylor UUCP %s, copyright (C) 1991, 92, 93, 94, 1995 Ian Lance Taylor\n",
zProgram, VERSION);
exit (EXIT_SUCCESS);
/*NOTREACHED*/
@@ -784,7 +788,7 @@ uusage ()
static void
uhelp ()
{
- printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n",
+ printf ("Taylor UUCP %s, copyright (C) 1991, 92, 93, 94, 1995 Ian Lance Taylor\n",
VERSION);
printf ("Usage: %s [options]\n", zProgram);
printf (" -s,-S,--system system: Call system (-S implies -f)\n");
@@ -877,6 +881,7 @@ fcall (puuconf, zconfig, fuuxqt, qorigsys, qport, fifwork, fforce, fdetach,
if (! fsysdep_get_status (qorigsys, &sstat, (boolean *) NULL))
return FALSE;
+ ubuffree (sstat.zstring);
/* Make sure it's been long enough since the last failed call, and
that we haven't exceeded the maximum number of retries. Even if
@@ -1205,8 +1210,10 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
pointer puuconf;
const struct uuconf_system *qsys;
struct sconnection *qconn;
- const char *zport;
int iuuconf;
+ int istrip;
+ boolean fstrip;
+ const char *zport;
char *zstr;
long istart_time;
char *zlog;
@@ -1215,6 +1222,14 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
qsys = qdaemon->qsys;
qconn = qdaemon->qconn;
+ iuuconf = uuconf_strip (puuconf, &istrip);
+ if (iuuconf != UUCONF_SUCCESS)
+ {
+ ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
+ return FALSE;
+ }
+ fstrip = (istrip & UUCONF_STRIP_PROTO) != 0;
+
*pterr = STATUS_LOGIN_FAILED;
if (qconn->qport == NULL)
@@ -1234,7 +1249,7 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
/* We should now see "Shere" from the other system. Newer systems
send "Shere=foo" where foo is the remote name. */
- zstr = zget_uucp_cmd (qconn, TRUE);
+ zstr = zget_uucp_cmd (qconn, TRUE, fstrip);
if (zstr == NULL)
return FALSE;
@@ -1339,7 +1354,7 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
return FALSE;
}
- }
+ }
zsend = zbufalc (strlen (qdaemon->zlocalname) + 70);
if (! qsys->uuconf_fsequence)
@@ -1385,7 +1400,7 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
/* Now we should see ROK or Rreason where reason gives a cryptic
reason for failure. If we are talking to a counterpart, we will
get back ROKN, possibly with a feature bitfield attached. */
- zstr = zget_uucp_cmd (qconn, TRUE);
+ zstr = zget_uucp_cmd (qconn, TRUE, fstrip);
if (zstr == NULL)
return FALSE;
@@ -1460,7 +1475,7 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
/* The slave should now send \020Pprotos\0 where protos is a list of
supported protocols. Each protocol is a single character. */
- zstr = zget_uucp_cmd (qconn, TRUE);
+ zstr = zget_uucp_cmd (qconn, TRUE, fstrip);
if (zstr == NULL)
return FALSE;
@@ -1618,7 +1633,7 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr)
before the hangup string. */
for (i = 0; i < 25; i++)
{
- zstr = zget_uucp_cmd (qconn, FALSE);
+ zstr = zget_uucp_cmd (qconn, FALSE, fstrip);
if (zstr == NULL)
break;
fdone = strstr (zstr, "OOOOOO") != NULL;
@@ -1700,13 +1715,23 @@ flogin_prompt (puuconf, zconfig, fuuxqt, qconn, zlogin)
struct sconnection *qconn;
const char *zlogin;
{
+ int iuuconf;
+ int istrip;
+ boolean fstrip;
char *zuser, *zpass;
boolean fret;
- int iuuconf;
struct scallin_info s;
DEBUG_MESSAGE0 (DEBUG_HANDSHAKE, "flogin_prompt: Waiting for login");
+ iuuconf = uuconf_strip (puuconf, &istrip);
+ if (iuuconf != UUCONF_SUCCESS)
+ {
+ ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
+ return FALSE;
+ }
+ fstrip = (istrip & UUCONF_STRIP_LOGIN) != 0;
+
zuser = NULL;
if (zlogin == NULL)
{
@@ -1715,7 +1740,7 @@ flogin_prompt (puuconf, zconfig, fuuxqt, qconn, zlogin)
ubuffree (zuser);
if (! fconn_write (qconn, "login: ", sizeof "login: " - 1))
return FALSE;
- zuser = zget_typed_line (qconn);
+ zuser = zget_typed_line (qconn, fstrip);
}
while (zuser != NULL && *zuser == '\0');
@@ -1731,7 +1756,7 @@ flogin_prompt (puuconf, zconfig, fuuxqt, qconn, zlogin)
return FALSE;
}
- zpass = zget_typed_line (qconn);
+ zpass = zget_typed_line (qconn, fstrip);
if (zpass == NULL)
{
ubuffree (zuser);
@@ -1819,10 +1844,12 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
const char **pzsystem;
{
long istart_time;
+ int iuuconf;
+ int istrip;
+ boolean fstrip;
const char *zport;
struct uuconf_port *qport;
struct uuconf_port sport;
- int iuuconf;
struct uuconf_dialer *qdialer;
struct uuconf_dialer sdialer;
boolean ftcp_port;
@@ -1847,6 +1874,17 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
istart_time = ixsysdep_time ((long *) NULL);
+ iuuconf = uuconf_strip (puuconf, &istrip);
+ if (iuuconf != UUCONF_SUCCESS)
+ {
+ ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
+ uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL,
+ (struct uuconf_port *) NULL,
+ &sport, (char *) NULL);
+ return FALSE;
+ }
+ fstrip = (istrip & UUCONF_STRIP_PROTO) != 0;
+
/* Figure out protocol parameters determined by the port. If no
port was specified we're reading standard input, so try to get
the port name and read information from the port file. We only
@@ -1907,7 +1945,7 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
}
else
qdialer = qport->uuconf_u.uuconf_smodem.uuconf_qdialer;
- }
+ }
else if (qport->uuconf_ttype == UUCONF_PORTTYPE_TCP
|| (qport->uuconf_ttype == UUCONF_PORTTYPE_TLI
&& (qport->uuconf_ireliable
@@ -1981,7 +2019,7 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
return FALSE;
}
- zstr = zget_uucp_cmd (qconn, TRUE);
+ zstr = zget_uucp_cmd (qconn, TRUE, fstrip);
if (zstr == NULL)
{
uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL,
@@ -2195,7 +2233,7 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
getopt, which is distributed with the program anyhow. */
optind = 0;
opterr = 0;
-
+
while ((iopt = getopt (pzset - paz, paz,
"N::p:Q:RU:v:x:")) != EOF)
{
@@ -2427,9 +2465,9 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc);
return FALSE;
}
-
+
/* The master will now send back the selected protocol. */
- zstr = zget_uucp_cmd (qconn, TRUE);
+ zstr = zget_uucp_cmd (qconn, TRUE, fstrip);
if (zstr == NULL)
{
sstat.ttype = STATUS_FAILED;
@@ -2581,7 +2619,7 @@ faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem)
string. */
for (i = 0; i < 25; i++)
{
- zstr = zget_uucp_cmd (qconn, FALSE);
+ zstr = zget_uucp_cmd (qconn, FALSE, fstrip);
if (zstr == NULL)
break;
fdone = strstr (zstr, "OOOOOO") != NULL;
@@ -2719,9 +2757,10 @@ fsend_uucp_cmd (qconn, z)
#define CINCREMENT (100)
static char *
-zget_uucp_cmd (qconn, frequired)
+zget_uucp_cmd (qconn, frequired, fstrip)
struct sconnection *qconn;
boolean frequired;
+ boolean fstrip;
{
char *zalc;
size_t calc;
@@ -2757,7 +2796,7 @@ zget_uucp_cmd (qconn, frequired)
while ((ctimeout = (int) (iendtime - ixsysdep_time ((long *) NULL))) > 0)
{
int b;
-
+
b = breceive_char (qconn, ctimeout, frequired);
/* Now b == -1 on timeout, -2 on error. */
if (b < 0)
@@ -2777,10 +2816,8 @@ zget_uucp_cmd (qconn, frequired)
}
/* Apparently some systems use parity on these strings, so we
- strip the parity bit. This may need to be configurable at
- some point, although only if system names can have eight bit
- characters. */
- if (! isprint (BUCHAR (b)))
+ optionally strip the parity bit. */
+ if (fstrip)
b &= 0x7f;
#if DEBUG > 1
@@ -2870,10 +2907,11 @@ zget_uucp_cmd (qconn, frequired)
did, ignore a leading \n to account for \r\n pairs. */
static char *
-zget_typed_line (qconn)
+zget_typed_line (qconn, fstrip)
struct sconnection *qconn;
+ boolean fstrip;
{
- static boolean flastcr;
+ static boolean flastcr;
char *zalc;
size_t calc;
size_t cgot;
@@ -2897,7 +2935,7 @@ zget_typed_line (qconn)
while (TRUE)
{
int b;
-
+
b = breceive_char (qconn, CTIMEOUT, FALSE);
/* Now b == -1 on timeout, -2 on error. */
@@ -2922,6 +2960,10 @@ zget_typed_line (qconn)
continue;
}
+ /* Optionally strip the parity bit. */
+ if (fstrip)
+ b &= 0x7f;
+
#if DEBUG > 1
if (FDEBUGGING (DEBUG_CHAT))
{
OpenPOWER on IntegriCloud