s3-lib Add myhostname_upper()
[ira/wip.git] / source3 / lib / util.c
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