summaryrefslogtreecommitdiffstats
path: root/src/lib/krb425/get_phost.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/krb425/get_phost.c')
-rw-r--r--src/lib/krb425/get_phost.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/krb425/get_phost.c b/src/lib/krb425/get_phost.c
new file mode 100644
index 000000000..6a60e7f1a
--- /dev/null
+++ b/src/lib/krb425/get_phost.c
@@ -0,0 +1,40 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * krb_get_phost for krb425
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_get_phost_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/copyright.h>
+#include "krb425.h"
+
+char *
+krb_get_phost(alias)
+char *alias;
+{
+ struct hostent *h;
+ char *phost = alias;
+
+ if ((h = gethostbyname(alias)) != (struct hostent *)0 ) {
+ char *p;
+#ifdef OLD_CRUFT
+ if (p = index( h->h_name, '.' ))
+ *p = 0;
+#endif
+ p = phost = h->h_name;
+ do {
+ if (isupper(*p)) *p=tolower(*p);
+ } while (*p++);
+ }
+ return(phost);
+}