r13369: let's have a way to show the samba4 version through ejs
authorSimo Sorce <idra@samba.org>
Mon, 6 Feb 2006 18:29:57 +0000 (18:29 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:50 +0000 (13:51 -0500)
and use it in provisioning to fullfill rfc 3045 requirements

source/scripting/ejs/smbcalls.c
source/scripting/libjs/provision.js
source/setup/provision_init.ldif

index 3e96f8bef2a296d448f986b9cfbd4a83f32c3987..b63687b3046203032ff37ee85980fe092a7e4ddf 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/appweb/ejs/ejs.h"
 #include "scripting/ejs/smbcalls.h"
 #include "smb_build.h"
+#include "version.h"
 
 /*
   return the type of a variable
@@ -111,6 +112,15 @@ static int ejs_libinclude(int eid, int argc, char **argv)
        return 0;
 }
 
+/*
+  return the current version
+*/
+static int ejs_version(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+       mpr_ReturnString(eid, SAMBA_VERSION_STRING);
+       return 0;
+}
+
 
 /*
   setup C functions that be called from ejs
@@ -146,5 +156,6 @@ void smb_setup_ejs_functions(void)
 
        ejsDefineCFunction(-1, "typeof", ejs_typeof, NULL, MPR_VAR_SCRIPT_HANDLE);
        ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE);
+       ejsDefineCFunction(-1, "version", ejs_version, NULL, MPR_VAR_SCRIPT_HANDLE);
 }
 
index fe112eeb247e7737284bd756c65f5d057331dc2e..84ed69231b0e258a4ec418fd43658a701dc19dba 100644 (file)
@@ -150,7 +150,6 @@ function hostname()
        return s[0];
 }
 
-
 /* the ldb is in bad shape, possibly due to being built from an
    incompatible previous version of the code, so delete it
    completely */
@@ -452,6 +451,7 @@ function provision_guess()
        assert(subobj.DOMAIN);
        assert(subobj.HOSTNAME);
 
+       subobj.VERSION      = version();
        subobj.HOSTIP       = hostip();
        subobj.DOMAINGUID   = randguid();
        subobj.DOMAINSID    = randsid();
index a54c5632ca952b03d79a43cf3e1b611095504e72..a029709d8cc3f0be1ba210c46f5e3d0edea0c858 100644 (file)
@@ -74,6 +74,8 @@ domainFunctionality: 0
 forestFunctionality: 0
 domainControllerFunctionality: 2
 isSynchronized: TRUE
+vendorName: Samba Team (http://samba.org)
+vendorVersion: ${VERSION}
 
 #Add modules to the list to activate them by default
 #beware often order is important