diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 15 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 28 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 16 | ||||
-rw-r--r-- | source3/rpc_server/srv_svcctl_nt.c | 3 | ||||
-rwxr-xr-x | source3/script/tests/wb_pad.sh | 2 |
6 files changed, 23 insertions, 42 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 98fb3b50c9..9b27ca608a 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4735,7 +4735,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/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; 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 @@ -2732,34 +2732,6 @@ NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename) } /**************************************************************************** - 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. ****************************************************************************/ 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); 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; 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 |