1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

160 Commits

Author SHA1 Message Date
Andrew Tridgell
c2691ef712 r8643: - make lp_configfile() work again
- get rid of redundeny dyn_CONFIGFILE argument to lp_load()

- fixed provisioning to work with completely pristine install,
  creating an initial smb.conf is none is present

- added lp.set() and lp.reload() to loadparm ejs object interface
2007-10-10 13:29:48 -05:00
Andrew Tridgell
ed4fb68ef7 r8640: continue the trend by moving the ejs random calls into an object 2007-10-10 13:29:48 -05:00
Andrew Tridgell
2dc493eea6 r8639: moved loadparm calls into an ejs object 2007-10-10 13:29:48 -05:00
Andrew Tridgell
a978484738 r8638: continue the trend of maknig our C functions true ejs objects by making the string functions
into an object. To keep existing code working I have added:

  string_init(global);

into base.js. That brings the functions into the global scope for our
existing scripts
2007-10-10 13:29:48 -05:00
Andrew Tridgell
5dbdf4fb33 r8637: added sys.stat() and sys.lstat() calls 2007-10-10 13:29:48 -05:00
Andrew Tridgell
6a1ed328e2 r8635: make object inheritance with the builtin objects easy by allowing
callers to optionally supply an existing object to add the properties
to. So you can do:

 var rpc = samr_init();
 lsa_init(rpc);

and you end up with 'rpc' having both the samr and lsa functions and
constants available.
2007-10-10 13:29:47 -05:00
Andrew Tridgell
8e788ae309 r8633: check for valid input to ejs_userAuth() 2007-10-10 13:29:46 -05:00
Andrew Tridgell
9e07c08a71 r8629: - moved the getDomainList() call out of smbcalls_auth.c and into libjs/auth.js
- tried to make the ejs_userAuth() call work for the sam, not just for
  unix auth. I didn't get this working. Andrew, when you get a chance
  can you see what I'm doing wrong? I suspect its because we aren't
  supplying a challenge, but a challenge doesn't really make sense in a
  'is this username/password' correct call.
2007-10-10 13:29:46 -05:00
Andrew Tridgell
4c1d6a97c0 r8602: allow options in ldb connect calls 2007-10-10 13:29:44 -05:00
Andrew Tridgell
632f7bbe3e r8582: added sys.httptime() call, to display a NTTIME as a http time string 2007-10-10 13:29:41 -05:00
Andrew Tridgell
2ae6a33846 r8581: fixed handling of 64 bit integers in rpc calls from ejs 2007-10-10 13:29:41 -05:00
Andrew Tridgell
9af48b8fc2 r8569: delete is a js reserved word, so use del instead 2007-10-10 13:29:39 -05:00
Andrew Tridgell
a3f3292e66 r8561: as with the other ejs subsystems, make nss into a object 2007-10-10 13:29:38 -05:00
Andrew Tridgell
21ca972d06 r8557: expose ldb_errstring() in ldb ejs code 2007-10-10 13:29:37 -05:00
Andrew Tridgell
a58ea6b385 r8520: fixed a pile of warnings from the build farm gcc -Wall output on
S390. This is an attempt to avoid the panic we're seeing in the
automatic builds.

The main fixes are:

 - assumptions that sizeof(size_t) == sizeof(int), mostly in printf formats

 - use of NULL format statements to perform dn searches.

 - assumption that sizeof() returns an int
2007-10-10 13:29:34 -05:00
Simo Sorce
e709e37928 r8516: let us use all parameters of ldbsearch in ldb.search 2007-10-10 13:29:33 -05:00
Simo Sorce
5a6c2170ff r8499: clearer function name 2007-10-10 13:23:10 -05:00
Andrew Tridgell
ccf20b2b13 r8489: neaten up the object handling 2007-10-10 13:23:09 -05:00
Andrew Tridgell
cf35818648 r8488: after discussions with simo, moved to a full OO interface, so you don't need to keep
a 'db' variable around. The ldb object knows what it is connected to.

Added a simple ldb testsuite in testprogs/ldb.js
2007-10-10 13:23:08 -05:00
Andrew Tridgell
98c9c4ecb8 r8486: switched to a separate connection operation in ldb interface
(a suggestion from simo)
2007-10-10 13:23:08 -05:00
Andrew Tridgell
9991e924e9 r8484: switched the sys_*() calls to the OO interface
tim, do you want to do the cli_*() calls now?
2007-10-10 13:23:08 -05:00
Andrew Tridgell
57d7a585e8 r8483: switched our generated ejs rpc code over to the new OO interface. This
means we don't pollute the name space, and also makes for faster
startup times as we only create variables for the pipes that we use,
not all pipes
2007-10-10 13:23:08 -05:00
Andrew Tridgell
3093057d97 r8481: switched ldb ejs called over to an OO interface, so you do:
var ldb = ldb_init();

res = ldb.search(dbfile, "(objectClass=user)");

you can also do:

ldbSearch = ldb.search;
res = ldbSearch(dbfile, "(objectClass=user)");

if you want the old interface (ie. you can use this to import
functions into the global or local namespace).
2007-10-10 13:23:07 -05:00
Andrew Tridgell
778bcd3738 r8452: allow for the ugly hack:
#!/bin/sh
exec smbscript "$0" ${1+"$@"}

which is needed because bloody solaris puts 'env' in /bin instead of /usr/bin

also neaten up the #! handling code.
2007-10-10 13:23:05 -05:00
Andrew Tridgell
f476e7aeec r8411: we need to use mprVarToNumber() instead of var->integer now, to cope with
the 64 bit integer support

this fixes the exit status from smbscript
2007-10-10 13:22:59 -05:00
Andrew Tridgell
632f99017d r8406: make sure we give an error in ldbAdd() if any record fails 2007-10-10 13:22:58 -05:00
Andrew Tridgell
52db7a052b r8399: move the ejs and esp code closer to the directory layout used by the
upstream sources. This makes it much easier to keep it up to date.

I will separate out the mpr code into lib/appweb/mpr next
2007-10-10 13:22:39 -05:00
Love Hörnquist Åstrand
56fd21c806 r8394: Make sure the argument to ctype is*(3) macros are unsigned char as
required by ISO C99.
2007-10-10 13:20:14 -05:00
Andrew Tridgell
7476cb9413 r8372: - split out provisioning logic into a separate ejs library
- added a provisioning web page
2007-10-10 13:20:13 -05:00
Tim Potter
797d9cf0c7 r8358: Return an error message if js include path not set instead of silently
failing.
2007-10-10 13:20:11 -05:00
Tim Potter
f76a7ec2a2 r8357: Call lp_load() so we can access the various lp_functions(). 2007-10-10 13:20:11 -05:00
Andrew Tridgell
abbf9c703c r8355: - added a vsprintf() function
- removed the --outputdir option from provision, as its not used any
  more (as ejs knows the real paths)
2007-10-10 13:20:10 -05:00
Andrew Tridgell
625628a3f6 r8340: - added sys_gmtime()
- added sys_unlink()

- added sys_file_load() and sys_file_save()

- use mprString() instead of mprCreateStringVar() to cope with NULL strings

- removed smbcalls_irpc.c as its not needed any more

- allow ldbAdd() and ldbModify() to take multiple ldif records

- added a sprintf() function to ejs. Quite complex, but very useful!
2007-10-10 13:20:08 -05:00
Andrew Tridgell
322c213783 r8339: added ldbAdd(), ldbModify(), ldbDelete() and ldbRename() to ejs ldb functions 2007-10-10 13:20:08 -05:00
Andrew Tridgell
28c1a1f3c0 r8337: - use 64 bit access functions in ejs calls
- added access to smbd random functions

- fixed ordering in join()

- added sys_interfaces(), sys_hostname(), sys_nttime() and sys_ldaptime()
2007-10-10 13:20:07 -05:00
Andrew Tridgell
b0f9ddafe9 r8333: merged with latest upstream ejs sources 2007-10-10 13:20:07 -05:00
Andrew Tridgell
0ef8f0282e r8331: added split(), join() and FileLoad() functions to ejs.
this gets me most of the way through a ejs provision script
2007-10-10 13:20:06 -05:00
Andrew Tridgell
570f071b15 r8320: make sure all our returned objects are full objects, which means they
have the toString() and valueOf() default attributes

this allows all our returned objects to be used in logical expressions
2007-10-10 13:20:06 -05:00
Andrew Tridgell
1517ad490d r8318: added a bunch more ejs calls.
getgr*()
  getpw*()
  strlower()
  strupper()
  IfaceList()
2007-10-10 13:20:06 -05:00
Andrew Tridgell
775fb56ac2 r8316: give full access to the popt command line parsing in ejs scripts, including
access to the samba common options. For example:

ok = GetOptions(ARGV, options,
		"POPT_AUTOHELP",
		"POPT_COMMON_SAMBA",
		"myopt=s",
		"intopt=i",
		"noopt");

this allows scripts to support their own extended options properly
2007-10-10 13:20:05 -05:00
Andrew Tridgell
ff60529ba2 r8297: add libinclude() function in ejs, which is like include() but searches a js library
path set in "js include" in smb.conf.

This will allow us to start building up a library of common js code,
while avoiding the problem of hard-coding include paths in scripts
2007-10-10 13:19:32 -05:00
Andrew Tridgell
6961fe2905 r8296: - split out the ejs auth functions into a separate file
- got rid of the one line ejs_returnlist()
2007-10-10 13:19:32 -05:00
Andrew Tridgell
061e20e509 r8284: - fixed some uninitialised variables in the irpc code
- added code to send multiple irpc calls in parallel, to all servers
  that have registered the given name, with output going in
  io.results[i]. This allows you to make rpc calls to multiple servers
  at once, which is needed for clients like smbstatus
2007-10-10 13:19:31 -05:00
Andrew Tridgell
1c6b1102e5 r8281: pass the callnum and rpc interface table directly from the generated
code in pidl for ejs calls. This means that ejs_rpc_call() doesn't
need to scan the rpc tables for the right interface, and doesn't need
to scan for the call name
2007-10-10 13:19:31 -05:00
Andrew Tridgell
1c170138a8 r8280: - added irpc_connect() for connecting to a irpc server by name
- make the dcerpc pipe in rpc_connect() a talloc child of the ejs
  connection variable. That means when the connection variable goes out
  of scope, the connection is automatically closed. That makes for a
  more natural interface for closing connections in a scripting language
  (tpot, you may wish to use mprSetPtrChild() in your smb glue code too)
2007-10-10 13:19:30 -05:00
Andrew Tridgell
9c885a7edb r8276: fixed the remaining memory leaks in smbscript. We can now loop doing
lots of rpc calls without memory usage increasing.
2007-10-10 13:19:30 -05:00
Andrew Tridgell
b220756cb4 r8273: fixed some memory leaks in smbscript. This required converting
file_load() to use talloc, which impacted quite a few bits of code,
including our smb.conf processing.

took the opportunity to remove the gloabls in params.c while doing this
2007-10-10 13:19:29 -05:00
Andrew Tridgell
595304708d r8262: - simplify the dependency handling for ejs modules
- added config.mk entries for some more pipes

- simplify the handling of ejs variables in the pidl code
2007-10-10 13:19:27 -05:00
Andrew Tridgell
0e54fa4466 r8260: added an init based registration system for the generated ejs rpc code, so
adding a new pipe only involves changes to librpc/config.mk
2007-10-10 13:19:27 -05:00
Andrew Tridgell
12d2092dd8 r8256: - allow rpc calls from non-command line ejs contexts by creating a set
of null credentials to use if cmdline_credentials is not setup

- hide the length and size elements of a lsa_String from js scripts,
  so you can use a lsa_String just as an ordinary string without
  knowing its a structure. We won't do this with all structures, just
  a few core ones that are used often enough to warrant it.

- make sure returned ldb arrays have a length property
2007-10-10 13:19:26 -05:00
Andrew Tridgell
ad1a4802d0 r8254: fixed a valgrind error in the unix auth code 2007-10-10 13:19:26 -05:00
Andrew Tridgell
9398b02e4b r8238: - fixed handling of NULL pointers from ejs
- added automatic creation of all constants in IDL as ejs variables
2007-10-10 13:19:23 -05:00
Andrew Tridgell
cbe5289ac9 r8236: fixed support for arrays of structures 2007-10-10 13:19:23 -05:00
Andrew Tridgell
a8cb2dbdcc r8233: - added support for more base types in pidl ejs
- added auto generation of a header with prototypes for public ejs functions

- make public functions non-static

- fixed allocation of fixed sized arrays

- added 'noejs' flag indicating that a typedef will be handled manually by ejs

- added manual functions for sid and GUID, so they show up as nice
  strings in ejs scripts

This allows ejs to bring in samr, security, lsa and misc IDL functions
2007-10-10 13:19:23 -05:00
Andrew Tridgell
e1cfc6d032 r8230: prevent authentication dying on a NULL domain 2007-10-10 13:19:22 -05:00
Andrew Tridgell
a61cdee384 r8220: added auto-generation of ENUM constants in ejs wrapper. So we can now use the enum name
instead of a integer in ejs scripts making rpc calls
2007-10-10 13:19:21 -05:00
Andrew Tridgell
f3ff48204c r8216: - handle union pull in ejs pidl generation
- added debugging calls for missing structure/union elements
2007-10-10 13:19:20 -05:00
Andrew Tridgell
49fc14d132 r8215: switched the pull side of the ejs generator over to the recursive LEVELS based approach.
This allows for much more complex structure mappings to be generated.
2007-10-10 13:19:20 -05:00
Andrew Tridgell
2e306be1d8 r8213: I've started to understand the LEVELS stuff in pidl much better now,
and have re-coded the push side of the ejs generator to use it
properly. It ends up being very neat and small, and should handle much
more complex structures (like arrays of pointers to unions etc).

Also added push side support for unions. This should get more of the
echo pipe working via ejs.
2007-10-10 13:19:20 -05:00
Andrew Tridgell
5f062d7148 r8200: - added stub functions for union pull/push
- kill the js interpreter with an exception on internal errors
2007-10-10 13:19:19 -05:00
Andrew Tridgell
a77c2aa860 r8198: - handled push/pull of simple strings in ejs
- improved the error handling, so the ejs wrappers don't just ignore a type they
  don't handle, instead an exception is issued saying what isn't handled
2007-10-10 13:19:19 -05:00
Andrew Tridgell
431b4b6888 r8195: - fixed handling of simple arrays. To keep the logic simple, I moved to making all push
functions taking a constant pointer to the type rather than having a different calling
  convention for scalars and pointers

- fixed the setting of the 'length' element in arrays
2007-10-10 13:19:18 -05:00
Andrew Tridgell
697b67ed57 r8194: delete the old hand-written ejs code for echo_AddOne. This is now
autogenerated by pidl
2007-10-10 13:19:18 -05:00
Andrew Tridgell
14b6436cc5 r8192: updated the glue code for the generated ejs functions from pidl
only handles a small subset of all IDL files so far
2007-10-10 13:19:18 -05:00
Andrew Tridgell
8649945cf9 r8114: fixed the build after tpots ejs commit .... 2007-10-10 13:19:10 -05:00
Tim Potter
ee27943e21 r8105: Add ejsrpc push/pull functions for uint16 and uint8. 2007-10-10 13:19:08 -05:00
Andrew Tridgell
b1ea58ddc4 r8073: a successful rpc call from ejs!
the ejs_echo.c code is the stuff that needs to be auto-generated by
pidl. It only does echo_AddOne so far.

We also need a table for registering these calls. The code is
hard-wired for echo_AddOne for now.
2007-10-10 13:19:05 -05:00
Andrew Tridgell
a782541db3 r8069: the beginnings of code to allow rpc calls to be made from ejs
tpot, note that this shows how you can modify passed in MprVar
variables in C call
2007-10-10 13:19:04 -05:00
Tim Potter
696aa182d5 r7928: Add rename, unlink and list commands.
list() returns a list of strings, but maybe it should be a list of
objects with size, attrib, short name etc.
2007-10-10 13:18:51 -05:00
Tim Potter
043feb131f r7924: Add mkdir() and rmdir() functions.
Write a macro to check tree handle parameters.
2007-10-10 13:18:51 -05:00
Tim Potter
9ed763f7fa r7922: Comment out complicated connect/session/tree API for the moment. Replace
with tree_connect() and tree_disconnect() functions.
2007-10-10 13:18:50 -05:00
Andrew Tridgell
3a3025485b r7633: this patch started as an attempt to make the dcerpc code use a given
event_context for the socket_connect() call, so that when things that
use dcerpc are running alongside anything else it doesn't block the
whole process during a connect.

Then of course I needed to change any code that created a dcerpc
connection (such as the auth code) to also take an event context, and
anything that called that and so on .... thus the size of the patch.

There were 3 places where I punted:

  - abartlet wanted me to add a gensec_set_event_context() call
    instead of adding it to the gensec init calls. Andrew, my
    apologies for not doing this. I didn't do it as adding a new
    parameter allowed me to catch all the callers with the
    compiler. Now that its done, we could go back and use
    gensec_set_event_context()

  - the ejs code calls auth initialisation, which means it should pass
    in the event context from the web server. I punted on that. Needs fixing.

  - I used a NULL event context in dcom_get_pipe(). This is equivalent
    to what we did already, but should be fixed to use a callers event
    context. Jelmer, can you think of a clean way to do that?

I also cleaned up a couple of things:

 - libnet_context_destroy() makes no sense. I removed it.

 - removed some unused vars in various places
2007-10-10 13:18:15 -05:00
Tim Potter
63577628b0 r7570: Add tree, session and socket disconnect ejs functions. 2007-10-10 13:18:10 -05:00
Andrew Bartlett
990e061939 r7530: Simply calling convention of lp_load().
This always loads all the services, as we now don't have an easy way
to split out smbd.

Andrew Bartlett
2007-10-10 13:18:07 -05:00
Tim Potter
5b67f2c3d9 r7505: Add more argument forms for session_setup().
Throw an exception if tree connect fails.
2007-10-10 13:18:01 -05:00
Tim Potter
3b7df1037d r7501: Fix credential initialisation in ejs session setup. Implement four
arg and anonymous version of command.

Implement ejs tconx.
2007-10-10 13:18:01 -05:00
Tim Potter
564dfe14d0 r7500: Initialise module subsystems. 2007-10-10 13:18:01 -05:00
Tim Potter
8574f64ca2 r7477: Add MPR_TYPE_PTR to ejs_typeof(). 2007-10-10 13:17:57 -05:00
Andrew Tridgell
30e876e9c2 r7461: this is the start of some code for mapping IDL onto ejs. This is hand
written code, and it doesn't work or even compile yet. I am committing
it to make it easier to discuss the approach with jelmer and tpot.

The intention is that this code will eventually end up being mostly
auto-generated (with the utility functions split out, just like
librpc/ndr/*.c)
2007-10-10 13:17:55 -05:00
Tim Potter
832332de5d r7457: Return an ejs C pointer object from the ejs connect() function.
Add a session_setup() function that does an anonymous session setup.  Will
add credential passing later.
2007-10-10 13:17:55 -05:00
Tim Potter
a55e40651d r7422: Create a ejs object to wrap a smbcli_transport pointer. 2007-10-10 13:17:51 -05:00
Tim Potter
8062e808ef r7351: Start of ejs smb client library. I need to figure out a nice API here
that doesn't expose too much of the cifs protocol but still allows
people to do neat things.

Also, talloc lifetimes need to be thought about properly.
2007-10-10 13:17:45 -05:00
Tim Potter
ada0045957 r7350: Remove unused label. 2007-10-10 13:17:45 -05:00
Simo Sorce
ddd7454cb3 r7268: allocate the strings to avoid them disappearing under our feet 2007-10-10 13:17:34 -05:00
Simo Sorce
41bae267e2 r7267: REMOTE_HOST is a better choice 2007-10-10 13:17:34 -05:00
Tim Potter
b086768589 r7266: Split the different types of js function defines into separate files,
as there are going to be a lot more of them.
2007-10-10 13:17:34 -05:00
Tim Potter
c77a232b11 r7263: Exit smbscript with the intepreter return value (defaults to 0).
Change the exit value for an exception, usage error and other non-js
errors to 127 which is kinda like the return value for the system(3)
function.
2007-10-10 13:17:33 -05:00
Tim Potter
4b775c619b r7262: Add a length property to ARGV array. 2007-10-10 13:17:33 -05:00
Tim Potter
1a4a549317 r7261: Pass by reference is done in js via MPR_TYPE_OBJECT. Update argument
parsing and example for resolveName().
2007-10-10 13:17:33 -05:00
Tim Potter
aef99859f2 r7255: Change syntax of resolveName() js function to be more like the
resolve_name() C function.  I can't figure out how to return variables
by reference though.  Writing to argv[] doesn't seem to work.
2007-10-10 13:17:32 -05:00
Tim Potter
2fa6f7bb2b r7254: Add a mprWERROR() function with the same attributes as mprNTSTATUS. 2007-10-10 13:17:32 -05:00
Simo Sorce
8a98572a3b r7238: Add pam auth support in swat 2007-10-10 13:17:30 -05:00
Tim Potter
d81d5f8317 r7225: Create a MprVar object from a NTSTATUS, e.g:
res: {
  is_err: true,
  is_ok: false,
  errstr: "NT_STATUS_IO_TIMEOUT",
  v: -1073741643
}
2007-10-10 13:17:28 -05:00
Tim Potter
31b9fadbed r7223: Advance script past interpreter line. 2007-10-10 13:17:27 -05:00
Tim Potter
14a2053c04 r7215: Convert smbscript to use ejsEvalScript() and file_load() instead of
ejsEvalFile().

Still need to add advancement of the script past the hash-bang line but
it's home time now!!
2007-10-10 13:17:27 -05:00
Andrew Tridgell
29ab4cc6cb r7135: make typeof() complient with ECMA 11.4.3 2007-10-10 13:17:21 -05:00
Tim Potter
6911e46c6a r7083: Add a ejs hook to the resolve_name() function.
We need to figure out what the best way to return NTSTATUS codes.  In the
Python wrappers I threw an exception which could be caught by some code,
but I'm not sure whether this is possible in ejs.
2007-10-10 13:17:14 -05:00
Tim Potter
54051bf8bb r7082: Call load_interfaces() in smbscript initialisation. 2007-10-10 13:17:13 -05:00
Tim Potter
790a46f53b r7081: Add mprToInt() function. 2007-10-10 13:17:13 -05:00
Tim Potter
fcf177c86e r7080: Fix typo in error message. 2007-10-10 13:17:13 -05:00