blob: a5570de34c902581d7e6e9eaa649ed0b52dabd3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/usr/bin/env smbscript
libinclude("base.js");
/* note: these require specifying a proper path in "js include" parameter */
libinclude("ejsnet/netusr.js");
libinclude("ejsnet/nethost.js");
function PrintNetHelp()
{
println("Usage: ejsnet.js <cmd> [options]");
}
/* here we start */
var options = GetOptions(ARGV,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"POPT_COMMON_CREDENTIALS");
if (options == undefined) {
PrintNetHelp();
return -1;
}
if (options.ARGV.length < 1) {
PrintNetHelp();
return -1;
}
/* use command line creds if available */
var creds = options.get_credentials();
var ctx = NetContext(creds);
var cmd = options.ARGV[0];
if (cmd == "user") {
UserManager(ctx, options);
} else if (cmd == "host") {
HostManager(ctx, options);
} else {
PrintNetHelp();
return -1;
}
return 0;
|