#!/usr/bin/env smbscript /* test samr calls from ejs */ var options = new Object(); ok = GetOptions(ARGV, options, "POPT_AUTOHELP", "POPT_COMMON_SAMBA", "POPT_COMMON_CREDENTIALS"); if (ok == false) { println("Failed to parse options: " + options.ERROR); return -1; } libinclude("base.js"); libinclude("samr.js"); /* test the samr_Connect interface */ function test_Connect(conn) { print("Testing samr_Connect\n"); return samrConnect(conn); } /* test the samr_LookupDomain interface */ function test_LookupDomain(conn, handle, domain) { print("Testing samr_LookupDomain\n"); return samrLookupDomain(conn, handle, domain); } /* test the samr_OpenDomain interface */ function test_OpenDomain(conn, handle, sid) { print("Testing samr_OpenDomain\n"); return samrOpenDomain(conn, handle, sid); } /* test the samr_EnumDomainUsers interface */ function test_EnumDomainUsers(conn, dom_handle) { var i, users; print("Testing samr_EnumDomainUsers\n"); users = samrEnumDomainUsers(conn, dom_handle); print("Found " + users.length + " users\n"); for (i=0;i"); return -1; } var binding = options.ARGV[0]; var conn = new Object(); print("Connecting to " + binding + "\n"); status = rpc_connect(conn, binding, "samr"); if (status.is_ok != true) { print("Failed to connect to " + binding + " - " + status.errstr + "\n"); return -1; } handle = test_Connect(conn); test_EnumDomains(conn, handle); samrClose(conn, handle); print("All OK\n"); return 0;