s3-lib Add myhostname_upper()
authorAndrew Bartlett <abartlet@samba.org>
Thu, 9 Jun 2011 05:27:53 +0000 (15:27 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Jun 2011 10:40:09 +0000 (12:40 +0200)
This varient always upper cases the hostname, which is needed for the
netbios name.

Andrew Bartlett

source3/include/proto.h
source3/lib/util.c

index edcb025101b8a9fa41927a7baf7b186ce4a33498..585d53f64385713e6e90cdb82da70b2d3fc84eac 100644 (file)
@@ -565,6 +565,7 @@ int set_maxfiles(int requested_max);
 int smb_mkstemp(char *name_template);
 void *smb_xmalloc_array(size_t size, unsigned int count);
 char *myhostname(void);
+char *myhostname_upper(void);
 char *lock_path(const char *name);
 char *pid_path(const char *name);
 char *state_path(const char *name);
index 499f5f7f6b0852f02ba38ece414d3aade1f503f2..51ad7bd3bd966658dbdc83c9a0abc08e6c6437cd 100644 (file)
@@ -1456,6 +1456,22 @@ char *myhostname(void)
        return ret;
 }
 
+/*****************************************************************
+ Get local hostname and cache result.
+*****************************************************************/
+
+char *myhostname_upper(void)
+{
+       char *name;
+       static char *ret;
+       if (ret == NULL) {
+               name = get_myname(talloc_tos());
+               ret = strupper_talloc(NULL, name);
+               talloc_free(name);
+       }
+       return ret;
+}
+
 /**
  * @brief Returns an absolute path to a file concatenating the provided
  * @a rootpath and @a basename