summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-12 23:52:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:06 -0500
commit342d229b4082004d30fa7018c04bba66da48a91b (patch)
treec3efe11c39d9561cde510ad38dcebba25a31fd7a /source4/scripting
parentf642fd96d0b196e7bb71bb73ffbefac32786d25f (diff)
downloadsamba-342d229b4082004d30fa7018c04bba66da48a91b.tar.gz
samba-342d229b4082004d30fa7018c04bba66da48a91b.tar.bz2
samba-342d229b4082004d30fa7018c04bba66da48a91b.zip
r10190: Do some very basic input checking when provisioning.
(This used to be commit 87f25fe49caa78422582337c5208a331ef5b8c15)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/libjs/provision.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index ef99dc43c5..33bfafac13 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -233,7 +233,9 @@ function provision(subobj, message, blank, paths)
subobj.REALM = strlower(subobj.REALM);
subobj.HOSTNAME = strlower(subobj.HOSTNAME);
subobj.DOMAIN = strupper(subobj.DOMAIN);
+ assert(valid_netbios_name(subobj.DOMAIN));
subobj.NETBIOSNAME = strupper(subobj.HOSTNAME);
+ assert(valid_netbios_name(subobj.NETBIOSNAME));
var rdns = split(",", subobj.BASEDN);
subobj.RDN_DC = substr(rdns[0], strlen("DC="));
@@ -431,5 +433,29 @@ member: %s
return enable_account(ldb, user_dn);
}
+// Check whether a name is valid as a NetBIOS name.
+// FIXME: There are probably more constraints here
+function valid_netbios_name(name)
+{
+ if (strlen(name) > 13) return false;
+ if (strstr(name, ".")) return false;
+ return true;
+}
+
+function provision_validate(subobj, message)
+{
+ if (!valid_netbios_name(subobj.DOMAIN)) {
+ message("Invalid NetBIOS name for domain\n");
+ return false;
+ }
+
+ if (!valid_netbios_name(subobj.NETBIOSNAME)) {
+ message("Invalid NetBIOS name for host\n");
+ return false;
+ }
+
+ return true;
+}
+
return 0;