Bugzilla Bug 322956: added PR_SI_HOSTNAME_UNTRUNCATED, which does not NSPRPUB_PRE_4_2_CLIENT_BRANCH
authorwtchang%redhat.com
Thu, 19 Jan 2006 22:14:40 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 3552 e19eca39e5a948e605795a87fdca0574e5c3cb83
parent 3543 06c3f234380be0dbd989d2c49935348df5085f9e
child 3557 6b758676d588cdaef46fdba621668d422a59cf77
push idunknown
push userunknown
push dateunknown
bugs322956
Bugzilla Bug 322956: added PR_SI_HOSTNAME_UNTRUNCATED, which does not strip the domain name (if any). The patch is contributed by Philip Prindeville <philipp@redfish-solutions.com>. r=wtc,darin. Modified files: prsystem.h prsystem.c Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
pr/include/prsystem.h
pr/src/misc/prsystem.c
--- a/pr/include/prsystem.h
+++ b/pr/include/prsystem.h
@@ -65,20 +65,23 @@ NSPR_API(char) PR_GetDirectorySepartor(v
 **  Paths are assumed to be of the form:
 **      <directory>[<sep><directory>]*
 */
 
 NSPR_API(char) PR_GetPathSeparator(void);
 
 /* Types of information available via PR_GetSystemInfo(...) */
 typedef enum {
-    PR_SI_HOSTNAME,
+    PR_SI_HOSTNAME,  /* the hostname with the domain name (if any)
+                      * removed */
     PR_SI_SYSNAME,
     PR_SI_RELEASE,
-    PR_SI_ARCHITECTURE
+    PR_SI_ARCHITECTURE,
+    PR_SI_HOSTNAME_UNTRUNCATED  /* the hostname exactly as configured
+                                 * on the system */
 } PRSysInfo;
 
 
 /*
 ** If successful returns a null termintated string in 'buf' for
 ** the information indicated in 'cmd'. If unseccussful the reason for
 ** the failure can be retrieved from PR_GetError().
 **
--- a/pr/src/misc/prsystem.c
+++ b/pr/src/misc/prsystem.c
@@ -129,18 +129,22 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(
 {
     PRUintn len = 0;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     switch(cmd)
     {
       case PR_SI_HOSTNAME:
+      case PR_SI_HOSTNAME_UNTRUNCATED:
         if (PR_FAILURE == _PR_MD_GETHOSTNAME(buf, (PRUintn)buflen))
             return PR_FAILURE;
+
+        if (cmd == PR_SI_HOSTNAME_UNTRUNCATED)
+            break;
         /*
          * On some platforms a system does not have a hostname and
          * its IP address is returned instead.   The following code
          * should be skipped on those platforms.
          */
 #ifndef _PR_GET_HOST_ADDR_AS_NAME
         /* Return the unqualified hostname */
             while (buf[len] && (len < buflen)) {