The Samba-Bugzilla – Attachment 5944 Details for
Bug 7658
fix some "dereferencing type-punned pointer will break strict-aliasing rules" warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 3.5
samba-3.5.4-buildwarnings.patch (text/plain), 12.63 KB, created by
Guenther Deschner
on 2010-09-01 05:20:43 UTC
(
hide
)
Description:
patch for 3.5
Filename:
MIME Type:
Creator:
Guenther Deschner
Created:
2010-09-01 05:20:43 UTC
Size:
12.63 KB
patch
obsolete
>From 1799be35526b2358a1c606b931d81df20ef19732 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Tue, 25 May 2010 12:43:00 +0200 >Subject: [PATCH] s3-net: fix a "dereferencing type-punned pointer will break strict-aliasing rules" warning. > >Guenther >(cherry picked from commit f12028a3fd5c64bc8e13996cb9a18a19ec0929e0) >--- > source3/utils/net_ads.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c >index 3cd4fd8..b618ab8 100644 >--- a/source3/utils/net_ads.c >+++ b/source3/utils/net_ads.c >@@ -541,7 +541,7 @@ static int ads_user_info(struct net_context *c, int argc, const char **argv) > char *escaped_user; > DOM_SID primary_group_sid; > uint32_t group_rid; >- enum SID_NAME_USE type; >+ enum wbcSidType type; > > if (argc < 1 || c->display_usage) { > return net_ads_user_usage(c, argc, argv); >@@ -596,7 +596,7 @@ static int ads_user_info(struct net_context *c, int argc, const char **argv) > wbc_status = wbcLookupSid((struct wbcDomainSid *)&primary_group_sid, > NULL, /* don't look up domain */ > &primary_group, >- (enum wbcSidType *) &type); >+ &type); > if (!WBC_ERROR_IS_OK(wbc_status)) { > d_fprintf(stderr, "wbcLookupSid: %s\n", > wbcErrorString(wbc_status)); >-- >1.7.2.2 > >From 04b2670b9fd331ba564b348617c6ccd3ff13a122 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Mon, 10 May 2010 14:44:30 +0200 >Subject: [PATCH 1/2] s3-rpcclient: fix two more invalid typecasts in spoolss commands. > >Guenther >(cherry picked from commit 83736066a3f94eaadb422016c9f22cb18bec2cd7) >--- > source3/rpcclient/cmd_spoolss.c | 56 ++++++++++++++++++++++++++++++++------ > 1 files changed, 47 insertions(+), 9 deletions(-) > >diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c >index 21fbaf9..e6b8d69 100644 >--- a/source3/rpcclient/cmd_spoolss.c >+++ b/source3/rpcclient/cmd_spoolss.c >@@ -462,6 +462,7 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli, > uint32_t info_level = 2; > union spoolss_PrinterInfo info; > struct spoolss_SetPrinterInfoCtr info_ctr; >+ struct spoolss_SetPrinterInfo2 info2; > const char *printername, *comment = NULL; > struct spoolss_DevmodeContainer devmode_ctr; > struct sec_desc_buf secdesc_ctr; >@@ -501,12 +502,30 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli, > > > /* Modify the comment. */ >- info.info2.comment = comment; >- info.info2.secdesc = NULL; >- info.info2.devmode = NULL; >+ info2.servername = info.info2.servername; >+ info2.printername = info.info2.printername; >+ info2.sharename = info.info2.sharename; >+ info2.portname = info.info2.portname; >+ info2.drivername = info.info2.drivername; >+ info2.comment = comment; >+ info2.location = info.info2.location; >+ info2.devmode_ptr = 0; >+ info2.sepfile = info.info2.sepfile; >+ info2.printprocessor = info.info2.printprocessor; >+ info2.datatype = info.info2.datatype; >+ info2.parameters = info.info2.parameters; >+ info2.secdesc_ptr = 0; >+ info2.attributes = info.info2.attributes; >+ info2.priority = info.info2.priority; >+ info2.defaultpriority = info.info2.defaultpriority; >+ info2.starttime = info.info2.starttime; >+ info2.untiltime = info.info2.untiltime; >+ info2.status = info.info2.status; >+ info2.cjobs = info.info2.cjobs; >+ info2.averageppm = info.info2.averageppm; > > info_ctr.level = 2; >- info_ctr.info.info2 = (struct spoolss_SetPrinterInfo2 *)&info.info2; >+ info_ctr.info.info2 = &info2; > > status = rpccli_spoolss_SetPrinter(cli, mem_ctx, > &pol, >@@ -540,6 +559,7 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli, > const char *printername, > *new_printername = NULL; > struct spoolss_SetPrinterInfoCtr info_ctr; >+ struct spoolss_SetPrinterInfo2 info2; > struct spoolss_DevmodeContainer devmode_ctr; > struct sec_desc_buf secdesc_ctr; > >@@ -577,12 +597,30 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli, > goto done; > > /* Modify the printername. */ >- info.info2.printername = new_printername; >- info.info2.devmode = NULL; >- info.info2.secdesc = NULL; >+ info2.servername = info.info2.servername; >+ info2.printername = new_printername; >+ info2.sharename = info.info2.sharename; >+ info2.portname = info.info2.portname; >+ info2.drivername = info.info2.drivername; >+ info2.comment = info.info2.comment; >+ info2.location = info.info2.location; >+ info2.devmode_ptr = 0; >+ info2.sepfile = info.info2.sepfile; >+ info2.printprocessor = info.info2.printprocessor; >+ info2.datatype = info.info2.datatype; >+ info2.parameters = info.info2.parameters; >+ info2.secdesc_ptr = 0; >+ info2.attributes = info.info2.attributes; >+ info2.priority = info.info2.priority; >+ info2.defaultpriority = info.info2.defaultpriority; >+ info2.starttime = info.info2.starttime; >+ info2.untiltime = info.info2.untiltime; >+ info2.status = info.info2.status; >+ info2.cjobs = info.info2.cjobs; >+ info2.averageppm = info.info2.averageppm; > >- info_ctr.level = info_level; >- info_ctr.info.info2 = (struct spoolss_SetPrinterInfo2 *)&info.info2; >+ info_ctr.level = 2; >+ info_ctr.info.info2 = &info2; > > status = rpccli_spoolss_SetPrinter(cli, mem_ctx, > &pol, >-- >1.7.2.2 > > >From 20eb15d8e9c097413a87a79e7874de677c5b3fd5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 3 Jun 2010 16:30:55 +0200 >Subject: [PATCH 2/2] s3-spoolss: add and use spoolss_printerinfo2_to_setprinterinfo2(). > >This fixes some invalid typecasts. > >Guenther >--- > source3/include/proto.h | 2 + > source3/rpc_client/init_spoolss.c | 29 +++++++++++++++ > source3/rpcclient/cmd_spoolss.c | 69 +++--------------------------------- > source3/utils/net_rpc_printer.c | 11 ++++-- > 4 files changed, 44 insertions(+), 67 deletions(-) > >diff --git a/source3/include/proto.h b/source3/include/proto.h >index 4d3fb63..483fd84 100644 >--- a/source3/include/proto.h >+++ b/source3/include/proto.h >@@ -5595,6 +5595,8 @@ WERROR pull_spoolss_PrinterData(TALLOC_CTX *mem_ctx, > WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, > enum winreg_Type type, > union spoolss_PrinterData *data); >+void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *i, >+ struct spoolss_SetPrinterInfo2 *s); > > /* The following definitions come from rpc_client/init_lsa.c */ > >diff --git a/source3/rpc_client/init_spoolss.c b/source3/rpc_client/init_spoolss.c >index 4c105ea..d557ff2 100644 >--- a/source3/rpc_client/init_spoolss.c >+++ b/source3/rpc_client/init_spoolss.c >@@ -73,3 +73,32 @@ WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, > } > return WERR_OK; > } >+ >+/******************************************************************* >+ ********************************************************************/ >+ >+void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *i, >+ struct spoolss_SetPrinterInfo2 *s) >+{ >+ s->servername = i->servername; >+ s->printername = i->printername; >+ s->sharename = i->sharename; >+ s->portname = i->portname; >+ s->drivername = i->drivername; >+ s->comment = i->comment; >+ s->location = i->location; >+ s->devmode_ptr = 0; >+ s->sepfile = i->sepfile; >+ s->printprocessor = i->printprocessor; >+ s->datatype = i->datatype; >+ s->parameters = i->parameters; >+ s->secdesc_ptr = 0; >+ s->attributes = i->attributes; >+ s->priority = i->priority; >+ s->defaultpriority = i->defaultpriority; >+ s->starttime = i->starttime; >+ s->untiltime = i->untiltime; >+ s->status = i->status; >+ s->cjobs = i->cjobs; >+ s->averageppm = i->averageppm; >+} >diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c >index e6b8d69..2d79b11 100644 >--- a/source3/rpcclient/cmd_spoolss.c >+++ b/source3/rpcclient/cmd_spoolss.c >@@ -502,27 +502,8 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli, > > > /* Modify the comment. */ >- info2.servername = info.info2.servername; >- info2.printername = info.info2.printername; >- info2.sharename = info.info2.sharename; >- info2.portname = info.info2.portname; >- info2.drivername = info.info2.drivername; >- info2.comment = comment; >- info2.location = info.info2.location; >- info2.devmode_ptr = 0; >- info2.sepfile = info.info2.sepfile; >- info2.printprocessor = info.info2.printprocessor; >- info2.datatype = info.info2.datatype; >- info2.parameters = info.info2.parameters; >- info2.secdesc_ptr = 0; >- info2.attributes = info.info2.attributes; >- info2.priority = info.info2.priority; >- info2.defaultpriority = info.info2.defaultpriority; >- info2.starttime = info.info2.starttime; >- info2.untiltime = info.info2.untiltime; >- info2.status = info.info2.status; >- info2.cjobs = info.info2.cjobs; >- info2.averageppm = info.info2.averageppm; >+ spoolss_printerinfo2_to_setprinterinfo2(&info.info2, &info2); >+ info2.comment = comment; > > info_ctr.level = 2; > info_ctr.info.info2 = &info2; >@@ -597,27 +578,8 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli, > goto done; > > /* Modify the printername. */ >- info2.servername = info.info2.servername; >- info2.printername = new_printername; >- info2.sharename = info.info2.sharename; >- info2.portname = info.info2.portname; >- info2.drivername = info.info2.drivername; >- info2.comment = info.info2.comment; >- info2.location = info.info2.location; >- info2.devmode_ptr = 0; >- info2.sepfile = info.info2.sepfile; >- info2.printprocessor = info.info2.printprocessor; >- info2.datatype = info.info2.datatype; >- info2.parameters = info.info2.parameters; >- info2.secdesc_ptr = 0; >- info2.attributes = info.info2.attributes; >- info2.priority = info.info2.priority; >- info2.defaultpriority = info.info2.defaultpriority; >- info2.starttime = info.info2.starttime; >- info2.untiltime = info.info2.untiltime; >- info2.status = info.info2.status; >- info2.cjobs = info.info2.cjobs; >- info2.averageppm = info.info2.averageppm; >+ spoolss_printerinfo2_to_setprinterinfo2(&info.info2, &info2); >+ info2.printername = new_printername; > > info_ctr.level = 2; > info_ctr.info.info2 = &info2; >@@ -1814,27 +1776,8 @@ static WERROR cmd_spoolss_setdriver(struct rpc_pipe_client *cli, > > /* Set the printer driver */ > >- info2.servername = info.info2.servername; >- info2.printername = info.info2.printername; >- info2.sharename = info.info2.sharename; >- info2.portname = info.info2.portname; >- info2.drivername = argv[2]; >- info2.comment = info.info2.comment; >- info2.location = info.info2.location; >- info2.devmode_ptr = 0; >- info2.sepfile = info.info2.sepfile; >- info2.printprocessor = info.info2.printprocessor; >- info2.datatype = info.info2.datatype; >- info2.parameters = info.info2.parameters; >- info2.secdesc_ptr = 0; >- info2.attributes = info.info2.attributes; >- info2.priority = info.info2.priority; >- info2.defaultpriority = info.info2.defaultpriority; >- info2.starttime = info.info2.starttime; >- info2.untiltime = info.info2.untiltime; >- info2.status = info.info2.status; >- info2.cjobs = info.info2.cjobs; >- info2.averageppm = info.info2.averageppm; >+ spoolss_printerinfo2_to_setprinterinfo2(&info.info2, &info2); >+ info2.drivername = argv[2]; > > info_ctr.level = 2; > info_ctr.info.info2 = &info2; >diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c >index 6c11a2f..dfc150f 100644 >--- a/source3/utils/net_rpc_printer.c >+++ b/source3/utils/net_rpc_printer.c >@@ -754,6 +754,7 @@ static bool net_spoolss_setprinter(struct rpc_pipe_client *pipe_hnd, > WERROR result; > NTSTATUS status; > struct spoolss_SetPrinterInfoCtr info_ctr; >+ struct spoolss_SetPrinterInfo2 info2; > struct spoolss_DevmodeContainer devmode_ctr; > struct sec_desc_buf secdesc_ctr; > >@@ -773,8 +774,8 @@ static bool net_spoolss_setprinter(struct rpc_pipe_client *pipe_hnd, > (void *)&info->info1; > break; > case 2: >- info_ctr.info.info2 = (struct spoolss_SetPrinterInfo2 *) >- (void *)&info->info2; >+ spoolss_printerinfo2_to_setprinterinfo2(&info->info2, &info2); >+ info_ctr.info.info2 = &info2; > break; > case 3: > info_ctr.info.info3 = (struct spoolss_SetPrinterInfo3 *) >@@ -2044,6 +2045,8 @@ NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c, > /* do something for all printers */ > for (i = 0; i < num_printers; i++) { > >+ struct spoolss_SetPrinterInfo2 info2; >+ > /* do some initialization */ > printername = info_enum[i].info2.printername; > sharename = info_enum[i].info2.sharename; >@@ -2095,8 +2098,8 @@ NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c, > d_printf(_("creating printer: %s\n"), printername); > > info_ctr.level = level; >- info_ctr.info.info2 = (struct spoolss_SetPrinterInfo2 *) >- (void *)&info_src.info2; >+ spoolss_printerinfo2_to_setprinterinfo2(&info_src.info2, &info2); >+ info_ctr.info.info2 = &info2; > > result = rpccli_spoolss_addprinterex(pipe_hnd_dst, > mem_ctx, >-- >1.7.2.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
bjacke
:
review+
vl
:
review+
Actions:
View
Attachments on
bug 7658
: 5944