From f02ad6414091d17588c506fb6a29660e22734f03 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 13 Jun 2006 15:34:27 +0000 Subject: [PATCH] Change kprop and kpropd to fall back on port 754 if krb5_prop isn't available via getservbyname rather than failing. Ticket: 3268 Version_Reported: 1.4.2 Component: krb5-misc git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18123 dc483132-0cff-0310-8789-dd5450dbe970 --- src/slave/kprop.c | 9 +++------ src/slave/kprop.h | 1 + src/slave/kpropd.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/slave/kprop.c b/src/slave/kprop.c index e730f4646..b2ea2c2b3 100644 --- a/src/slave/kprop.c +++ b/src/slave/kprop.c @@ -346,13 +346,10 @@ open_connection(host, fd, Errmsg, ErrmsgSz) if(!port) { sp = getservbyname(KPROP_SERVICE, "tcp"); if (sp == 0) { - (void) strncpy(Errmsg, KPROP_SERVICE, ErrmsgSz - 1); - Errmsg[ErrmsgSz - 1] = '\0'; - (void) strncat(Errmsg, "/tcp: unknown service", ErrmsgSz - 1 - strlen(Errmsg)); - *fd = -1; - return(0); + my_sin.sin_port = htons(KPROP_PORT); + } else { + my_sin.sin_port = sp->s_port; } - my_sin.sin_port = sp->s_port; } else my_sin.sin_port = port; s = socket(AF_INET, SOCK_STREAM, 0); diff --git a/src/slave/kprop.h b/src/slave/kprop.h index 93e147e51..bc601de54 100644 --- a/src/slave/kprop.h +++ b/src/slave/kprop.h @@ -29,6 +29,7 @@ #define KPROP_SERVICE_NAME "host" #define TGT_SERVICE_NAME "krbtgt" #define KPROP_SERVICE "krb5_prop" +#define KPROP_PORT 754 #define KPROP_PROT_VERSION "kprop5_01" diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c index 6ded72aed..9d87b9ebf 100644 --- a/src/slave/kpropd.c +++ b/src/slave/kpropd.c @@ -193,9 +193,9 @@ void do_standalone() sp = getservbyname(KPROP_SERVICE, "tcp"); if (sp == NULL) { com_err(progname, 0, "%s/tcp: unknown service", KPROP_SERVICE); - exit(1); + my_sin.sin_port = htons(KPROP_PORT); } - my_sin.sin_port = sp->s_port; + else my_sin.sin_port = sp->s_port; } else { my_sin.sin_port = port; } -- 2.26.2