From dbac75b466831cade91dfad21a2bcbe4bd551b37 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 11:26:11 +0200 Subject: popt: add a popt_common_debuglevel set of options providing -d|--debuglevel Michael (This used to be commit e7d08b673066a63aaa7ab54ac59566ae8a975672) --- source3/lib/popt_common.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index 25e41ab5f3..b151f22742 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -171,6 +171,12 @@ struct poptOption popt_common_version[] = { POPT_TABLEEND }; +struct poptOption popt_common_debuglevel[] = { + { NULL, 0, POPT_ARG_CALLBACK, (void *)popt_common_callback }, + { "debuglevel", 'd', POPT_ARG_STRING, NULL, 'd', "Set debug level", "DEBUGLEVEL" }, + POPT_TABLEEND +}; + /* Handle command line options: * --sbindir -- cgit From 32df537a24f8f24a90dd9f159efc5e2bf527e43f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jul 2008 10:43:28 +0200 Subject: dbwrap: when clustering = yes, don't fall back to db_open_tdb in db_open Michael (This used to be commit 33188a991f7e2f8dc1b5beed1dde1b7f77403e1a) --- source3/lib/dbwrap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 7fe1631bff..a686ba6b7c 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -60,8 +60,15 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, sockname = CTDB_PATH; } - if (lp_clustering() && socket_exist(sockname)) { + if (lp_clustering()) { const char *partname; + + if (!socket_exist(sockname)) { + DEBUG(1, ("ctdb socket does not exist - is ctdb not " + "running?\n")); + return NULL; + } + /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); if (partname) { -- cgit From 56681032b288ed924b40ab353c632a1fb153759d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jul 2008 10:53:06 +0200 Subject: dbwrap: when clustering = yes, don't fall back to db_open_tdb in db_open_trans. Michael (This used to be commit 013d29c70438bfd43bd11cbb13ba707b256f9b18) --- source3/lib/dbwrap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index a686ba6b7c..6dfe0b3766 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -127,8 +127,15 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx, sockname = CTDB_PATH; } - if (lp_clustering() && socket_exist(sockname)) { + if (lp_clustering()) { const char *partname; + + if (!socket_exist(sockname)) { + DEBUG(1, ("ctdb socket does not exist - is ctdb not " + "running?\n")); + return NULL; + } + /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); if (partname) { -- cgit From 5a8b0fe99f302e5d1ff2b47a1fe617ccd3a8b7b7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 15:27:14 +0200 Subject: dbwrap: don't panic in db_open() when attaching to ctdb fails. Michael (This used to be commit b9c008d9bd8b8119007e7ad03a40235998af4f5c) --- source3/lib/dbwrap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 6dfe0b3766..b498c46615 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -83,8 +83,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, if (result == NULL) { DEBUG(0,("failed to attach to ctdb %s\n", partname)); - smb_panic("failed to attach to a ctdb " - "database"); + return NULL; } } } -- cgit From 3899851af02bb5b858ee025504b4c7f12385c0c7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 15:27:46 +0200 Subject: dbwrap: don't panic in db_open_trans() when attaching to ctdb fails. Michael (This used to be commit 308fc7d5bf5f5ccfc73677b052a4e6ecede25921) --- source3/lib/dbwrap.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index b498c46615..2bff5d9257 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -150,8 +150,6 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx, if (result == NULL) { DEBUG(0,("failed to attach to ctdb %s\n", partname)); - smb_panic("failed to attach to a ctdb " - "database"); } return result; } -- cgit From fc6216b2da1087065c26e874058de74ced692fcc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 16:43:26 +0200 Subject: dbwrap: don't panic in db_open_trans() if called with TDB_CLEAR_IF_FIRST. return NULL instead and leave appropriated measures to the caller. Michael (This used to be commit 1002507b56a13420d8178c5397610edd839a7584) --- source3/lib/dbwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 2bff5d9257..eec15a84bd 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -118,7 +118,7 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx, if (tdb_flags & TDB_CLEAR_IF_FIRST) { DEBUG(0,("db_open_trans: called with TDB_CLEAR_IF_FIRST: %s\n", name)); - smb_panic("db_open_trans: called with TDB_CLEAR_IF_FIRST"); + return NULL; } #ifdef CLUSTER_SUPPORT -- cgit From b3152fb26849fa90347b315adbbebf57366c9927 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 9 Jul 2008 10:39:24 +0200 Subject: netapi: Correctly increase idx when displaying user information (This used to be commit 5fad9de2507b88820149def31faa28e5e45f7b5f) --- source3/lib/netapi/examples/user/user_dispinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/netapi/examples/user/user_dispinfo.c b/source3/lib/netapi/examples/user/user_dispinfo.c index 9f862505aa..c7d3112d71 100644 --- a/source3/lib/netapi/examples/user/user_dispinfo.c +++ b/source3/lib/netapi/examples/user/user_dispinfo.c @@ -78,11 +78,13 @@ int main(int argc, const char **argv) if (status == 0 || status == ERROR_MORE_DATA) { user = (struct NET_DISPLAY_USER *)buffer; for (i=0; iusri1_name); + printf("user %d: %s\n", i + idx,i + user->usri1_name); user++; } NetApiBufferFree(buffer); } + idx += entries_read; } while (status == ERROR_MORE_DATA); if (status != 0) { -- cgit From 730678c73177474ef8614f979661d9f6119a61f4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 22:46:12 +0200 Subject: netapi: fix vim(?)-typo Michael (This used to be commit 7a7bddd75413dba3c0c43fab68a115cf0445f12b) --- source3/lib/netapi/examples/user/user_dispinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/netapi/examples/user/user_dispinfo.c b/source3/lib/netapi/examples/user/user_dispinfo.c index c7d3112d71..23024fe9fe 100644 --- a/source3/lib/netapi/examples/user/user_dispinfo.c +++ b/source3/lib/netapi/examples/user/user_dispinfo.c @@ -78,7 +78,7 @@ int main(int argc, const char **argv) if (status == 0 || status == ERROR_MORE_DATA) { user = (struct NET_DISPLAY_USER *)buffer; for (i=0; iusri1_name); user++; } -- cgit