From e3ceb0c65333cb870463971021e3af24d82abf26 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 14 Apr 2009 12:00:39 +0200 Subject: s3-spoolss: remove unused dup_nt_devicemode(). Guenther --- source3/include/proto.h | 1 - source3/printing/nt_printing.c | 28 ---------------------------- 2 files changed, 29 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index b8ba8c03ad..25e81fde11 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4843,7 +4843,6 @@ WERROR move_driver_to_download_area(struct pipes_struct *p, int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen); uint32 del_a_printer(const char *sharename); NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename); -NT_DEVICEMODE *dup_nt_devicemode(NT_DEVICEMODE *nt_devicemode); void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr); int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen); int add_new_printer_key( NT_PRINTER_DATA *data, const char *name ); diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index c20171b049..f3b938e6ff 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2731,34 +2731,6 @@ NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename) return nt_devmode; } -/**************************************************************************** - Deepcopy an NT devicemode. -****************************************************************************/ - -NT_DEVICEMODE *dup_nt_devicemode(NT_DEVICEMODE *nt_devicemode) -{ - NT_DEVICEMODE *new_nt_devicemode = NULL; - - if ( !nt_devicemode ) - return NULL; - - if ((new_nt_devicemode = (NT_DEVICEMODE *)memdup(nt_devicemode, sizeof(NT_DEVICEMODE))) == NULL) { - DEBUG(0,("dup_nt_devicemode: malloc fail.\n")); - return NULL; - } - - new_nt_devicemode->nt_dev_private = NULL; - if (nt_devicemode->nt_dev_private != NULL) { - if ((new_nt_devicemode->nt_dev_private = (uint8 *)memdup(nt_devicemode->nt_dev_private, nt_devicemode->driverextra)) == NULL) { - SAFE_FREE(new_nt_devicemode); - DEBUG(0,("dup_nt_devicemode: malloc fail.\n")); - return NULL; - } - } - - return new_nt_devicemode; -} - /**************************************************************************** Clean up and deallocate a (maybe partially) allocated NT_DEVICEMODE. ****************************************************************************/ -- cgit From fa302020ee39bf39bf324983cf8e381232691e76 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 14 Apr 2009 12:08:55 +0200 Subject: s3-svcctl: fix memcpy in _svcctl_EnumServicesStatusW(). Make sure we are not copying more than what we have as valid data. Fix from Jeremy. Thanks a lot for watching this so closely! Guenther --- source3/rpc_server/srv_svcctl_nt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 0b0ef83bee..d73f73f9ec 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -464,9 +464,8 @@ WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ntstatus_to_werror(ndr_map_error2ntstatus(ndr_err)); } - blob = ndr_push_blob(ndr); - memcpy(r->out.service, blob.data, r->in.offered); + memcpy(r->out.service, blob.data, MIN(blob.length, r->in.offered)); } *r->out.needed = (buffer_size > r->in.offered) ? buffer_size : r->in.offered; -- cgit From 1b9384a11f2957bcfbe9f23e023c79535d4a7bc9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 14 Apr 2009 14:55:24 +0200 Subject: s3-nsswitch: fix make test_wbpad. Guenther --- source3/script/tests/wb_pad.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/script/tests/wb_pad.sh b/source3/script/tests/wb_pad.sh index f1f5ca24c4..10cedc897d 100755 --- a/source3/script/tests/wb_pad.sh +++ b/source3/script/tests/wb_pad.sh @@ -46,7 +46,7 @@ cleanup() { rmdir $tempdir } -cflags="-I. -I./../lib/replace -Iinclude" +cflags="-I. -I../ -I./../lib/replace -Iinclude" ${CC:-gcc} -m32 $RPM_OPT_FLAGS $CFLAGS -o $tempdir/wb_pad_32 $cflags $tempdir/wb_pad.c if [ $? -ne 0 ]; then cleanup -- cgit From ca3de0103b545c86c8507dfc7d042f1838d5dfb2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 14 Apr 2009 22:39:36 +0200 Subject: netdomjoin-gui: make sure to grey out change fields when not running as root. Guenther --- .../lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3') diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 40a6e415eb..8164b7456b 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -78,6 +78,7 @@ typedef struct join_state { gboolean hostname_changed; uint32_t stored_num_ous; char *target_hostname; + uid_t uid; } join_state; static void debug(const char *format, ...) @@ -1440,6 +1441,10 @@ static int draw_main_window(struct join_state *state) /* Entry */ entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry), 256); + + if (state->uid != 0) { + gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE); + } g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(callback_enter_computer_description_and_unlock), state); @@ -1526,6 +1531,9 @@ static int draw_main_window(struct join_state *state) G_CALLBACK(callback_do_change), (gpointer)state); gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); + if (state->uid != 0) { + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); + } gtk_widget_show(button); /* Label (hidden) */ @@ -1533,6 +1541,11 @@ static int draw_main_window(struct join_state *state) gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE); gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0); gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0); + if (state->uid != 0) { + gtk_label_set_text(GTK_LABEL(state->label_reboot), + "You cannot change computer description as you're not running with root permissions"); + } + gtk_widget_show(state->label_reboot); #if 0 @@ -1763,6 +1776,8 @@ static int initialize_join_state(struct join_state *state, return -1; } + state->uid = geteuid(); + state->ctx = ctx; return 0; -- cgit From 4721be488ceb8229d564e4b63ca9937603394e51 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 14 Apr 2009 23:19:25 +0200 Subject: s3-spoolss: Fix format of description string in spoolss_PrinterInfo1. This is what windows does and should get us closer to show the appropriate printer location string in explorer. Guenther --- source3/rpc_server/srv_spoolss_nt.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index effbb92266..d114152f64 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -4128,25 +4128,21 @@ static WERROR construct_printer_info1(TALLOC_CTX *mem_ctx, struct spoolss_PrinterInfo1 *r, int snum) { - char *chaine = NULL; r->flags = flags; + r->description = talloc_asprintf(mem_ctx, "%s,%s,%s", + ntprinter->info_2->printername, + ntprinter->info_2->drivername, + ntprinter->info_2->location); + W_ERROR_HAVE_NO_MEMORY(r->description); + if (*ntprinter->info_2->comment == '\0') { r->comment = talloc_strdup(mem_ctx, lp_comment(snum)); - chaine = talloc_asprintf(mem_ctx, - "%s,%s,%s", ntprinter->info_2->printername, - ntprinter->info_2->drivername, lp_comment(snum)); } else { r->comment = talloc_strdup(mem_ctx, ntprinter->info_2->comment); /* saved comment */ - chaine = talloc_asprintf(mem_ctx, - "%s,%s,%s", ntprinter->info_2->printername, - ntprinter->info_2->drivername, ntprinter->info_2->comment); } - W_ERROR_HAVE_NO_MEMORY(chaine); W_ERROR_HAVE_NO_MEMORY(r->comment); - r->description = talloc_strdup(mem_ctx, chaine); - W_ERROR_HAVE_NO_MEMORY(r->description); r->name = talloc_strdup(mem_ctx, ntprinter->info_2->printername); W_ERROR_HAVE_NO_MEMORY(r->name); -- cgit