From d95e86b8b938692ced7802fbfd5331d8cd48cd5e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 27 Sep 2002 04:33:58 +0000 Subject: Minor updates: Add const to some more functions, and reintroduce 'net rpc join oldstyle' as *only* trying an old-style join. This means that we can rely on it not prompting for a password on the build farm. Andrew Bartlett (This used to be commit 31bdbeef0ea6f30247cd3b30cfea57b34102abe6) --- source3/utils/net.c | 7 ++++++- source3/utils/net_rpc.c | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net.c b/source3/utils/net.c index 800aeded0a..b3b72e2465 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -277,8 +277,13 @@ struct cli_state *net_make_ipc_connection(unsigned flags) } else { nt_status = connect_to_ipc(&cli, &server_ip, server_name); } + SAFE_FREE(server_name); - return cli; + if (NT_STATUS_IS_OK(nt_status)) { + return cli; + } else { + return NULL; + } } static int net_user(int argc, const char **argv) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 8b8278b053..11f73a1387 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -309,15 +309,24 @@ static int rpc_join_usage(int argc, const char **argv) * Main 'net_rpc_join()' (where the admain username/password is used) is * in net_rpc_join.c * Assume if a -U is specified, it's the new style, otherwise it's the - * old style + * old style. If 'oldstyle' is specfied explicity, do it and don't prompt. **/ int net_rpc_join(int argc, const char **argv) { - if ((net_rpc_join_oldstyle(argc, argv) == 0)) - return 0; - - return net_rpc_join_newstyle(argc, argv); + struct functable func[] = { + {"oldstyle", net_rpc_join_oldstyle}, + {NULL, NULL} + }; + + if (argc == 0) { + if ((net_rpc_join_oldstyle(argc, argv) == 0)) + return 0; + + return net_rpc_join_newstyle(argc, argv); + } + + return net_run_function(argc, argv, func, rpc_join_usage); } -- cgit