From 29075c97d3b7111e2565ede1cd0f000fd2534375 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 20 Jul 2002 13:02:47 +0000 Subject: More fixes towards warnings on the IRIX compiler (and yes, some of these are real bugs) In particular, the samr code was doing an &foo of various types, to a function that assumed uint32. If time_t isn't 32 bits long, that broke. They are assignment compatible however, so use that and an intermediate variable. Andrew Bartlett (This used to be commit 30d0998c8c1a1d4de38ef0fbc83c2b763e05a3e6) --- source3/client/smbspool.c | 13 +++++-------- source3/libads/ldap.c | 4 ++-- source3/passdb/secrets.c | 2 +- source3/printing/load.c | 8 ++++---- source3/printing/pcap.c | 9 ++------- source3/printing/print_svid.c | 2 +- source3/rpc_server/srv_samr_nt.c | 35 ++++++++++++++++++++++++++--------- source3/utils/net_rpc_join.c | 8 +++++--- 8 files changed, 46 insertions(+), 35 deletions(-) (limited to 'source3') diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index b78d9d22a8..7804669cc8 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -284,18 +284,15 @@ smb_connect(char *workgroup, /* I - Workgroup */ nt_status = cli_full_connection(&c, myname, server, NULL, 0, share, "?????", username, lp_workgroup(), password, 0); - if (NT_STATUS_IS_OK(nt_status)) { - return c; - } else { + if (!NT_STATUS_IS_OK(nt_status)) { fprintf(stderr, "ERROR: Connection failed with error %s\n", nt_errstr(nt_status)); return NULL; } - - /* - * Return the new connection... - */ - + /* + * Return the new connection... + */ + return (c); } diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 9d15c4e33c..f91ef4b8a0 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -230,7 +230,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path, else { /* This would be the utf8-encoded version...*/ /* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */ - if (!(str_list_copy(&search_attrs, (char **) attrs))) + if (!(str_list_copy(&search_attrs, attrs))) { rc = LDAP_NO_MEMORY; goto done; @@ -453,7 +453,7 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope, else { /* This would be the utf8-encoded version...*/ /* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */ - if (!(str_list_copy(&search_attrs, (char **) attrs))) + if (!(str_list_copy(&search_attrs, attrs))) { rc = LDAP_NO_MEMORY; goto done; diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 3ecaf52e58..a737a2d049 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -178,7 +178,7 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16], if (plaintext) { /* we have an ADS password - use that */ DEBUG(4,("Using ADS machine password\n")); - E_md4hash((uchar *)plaintext, ret_pwd); + E_md4hash(plaintext, ret_pwd); SAFE_FREE(plaintext); return True; } diff --git a/source3/printing/load.c b/source3/printing/load.c index ed967fb0a7..cd90cbb6f3 100644 --- a/source3/printing/load.c +++ b/source3/printing/load.c @@ -38,7 +38,7 @@ auto-load some homes and printer services ***************************************************************************/ static void add_auto_printers(void) { - char *p; + const char *p; int printers; char *str = strdup(lp_auto_services()); @@ -47,9 +47,9 @@ static void add_auto_printers(void) printers = lp_servicenumber(PRINTERS_NAME); if (printers < 0) { - SAFE_FREE(str); - return; - } + SAFE_FREE(str); + return; + } for (p=strtok(str,LIST_SEP);p;p=strtok(NULL,LIST_SEP)) { if (lp_servicenumber(p) >= 0) continue; diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index 4bca63fffb..46d1128b8e 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -241,12 +241,9 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername) Scan printcap file pszPrintcapname for a printer called pszPrintername. Return True if found, else False. Returns False on error, too, after logging the error at level 0. For generality, the printcap name may be passed - if -passed as NULL, the configuration will be queried for the name. pszPrintername -must be in DOS codepage. -The xxx_printername_ok functions need fixing to understand they are being -given a DOS codepage. FIXME !! JRA. +passed as NULL, the configuration will be queried for the name. ***************************************************************************/ -BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) +BOOL pcap_printername_ok(const char *pszPrintername, const char *pszPrintcapname) { char *line=NULL; char *psz; @@ -305,8 +302,6 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) if (strequal(p,pszPrintername)) { - /* normalise the case */ - pstrcpy(pszPrintername,p); SAFE_FREE(line); x_fclose(pfile); return(True); diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index 44127c3700..837a2fba48 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -126,7 +126,7 @@ void sysv_printer_fn(void (*fn)(char *, char *)) * provide the equivalent of pcap_printername_ok() for SVID/XPG4 conforming * systems. */ -int sysv_printername_ok(char *name) +int sysv_printername_ok(const char *name) { printer_t *tmp; diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 88d728d810..96960611b7 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -2081,6 +2081,8 @@ NTSTATUS _samr_query_dom_info(pipes_struct *p, SAMR_Q_QUERY_DOMAIN_INFO *q_u, SA time_t u_logout; NTTIME nt_logout; + uint32 account_policy_temp; + uint32 num_users=0, num_groups=0, num_aliases=0; if ((ctr = (SAM_UNK_CTR *)talloc_zero(p->mem_ctx, sizeof(SAM_UNK_CTR))) == NULL) @@ -2098,12 +2100,22 @@ NTSTATUS _samr_query_dom_info(pipes_struct *p, SAMR_Q_QUERY_DOMAIN_INFO *q_u, SA switch (q_u->switch_value) { case 0x01: - account_policy_get(AP_MIN_PASSWORD_LEN, &min_pass_len); - account_policy_get(AP_PASSWORD_HISTORY, &pass_hist); - account_policy_get(AP_USER_MUST_LOGON_TO_CHG_PASS, &flag); - account_policy_get(AP_MAX_PASSWORD_AGE, (int *)&u_expire); - account_policy_get(AP_MIN_PASSWORD_AGE, (int *)&u_min_age); + + account_policy_get(AP_MIN_PASSWORD_LEN, &account_policy_temp); + min_pass_len = account_policy_temp; + + account_policy_get(AP_PASSWORD_HISTORY, &account_policy_temp); + pass_hist = account_policy_temp; + + account_policy_get(AP_USER_MUST_LOGON_TO_CHG_PASS, &account_policy_temp); + flag = account_policy_temp; + account_policy_get(AP_MAX_PASSWORD_AGE, &account_policy_temp); + u_expire = account_policy_temp; + + account_policy_get(AP_MIN_PASSWORD_AGE, &account_policy_temp); + u_min_age = account_policy_temp; + unix_to_nt_time_abs(&nt_expire, u_expire); unix_to_nt_time_abs(&nt_min_age, u_min_age); @@ -2149,10 +2161,15 @@ NTSTATUS _samr_query_dom_info(pipes_struct *p, SAMR_Q_QUERY_DOMAIN_INFO *q_u, SA init_unk_info7(&ctr->info.inf7); break; case 0x0c: - account_policy_get(AP_LOCK_ACCOUNT_DURATION, (int *)&u_lock_duration); - account_policy_get(AP_RESET_COUNT_TIME, (int *)&u_reset_time); - account_policy_get(AP_BAD_ATTEMPT_LOCKOUT, &lockout); - + account_policy_get(AP_LOCK_ACCOUNT_DURATION, &account_policy_temp); + u_lock_duration = account_policy_temp; + + account_policy_get(AP_RESET_COUNT_TIME, &account_policy_temp); + u_reset_time = account_policy_temp; + + account_policy_get(AP_BAD_ATTEMPT_LOCKOUT, &account_policy_temp); + lockout = account_policy_temp; + unix_to_nt_time_abs(&nt_lock_duration, u_lock_duration); unix_to_nt_time_abs(&nt_reset_time, u_reset_time); diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index cc1a203ca1..61adb2a8ff 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -80,8 +80,9 @@ int net_rpc_join_newstyle(int argc, const char **argv) fstring domain; uint32 num_rids, *name_types, *user_rids; uint32 flags = 0x3e8; - const char *acct_name; - + char *acct_name; + const char *const_acct_name; + /* Connect to remote machine */ if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC))) @@ -162,7 +163,8 @@ int net_rpc_join_newstyle(int argc, const char **argv) CHECK_RPC_ERR_DEBUG(cli_samr_lookup_names(cli, mem_ctx, &domain_pol, flags, - 1, &acct_name, &num_rids, + 1, &const_acct_name, + &num_rids, &user_rids, &name_types), ("error looking up rid for user %s: %s\n", acct_name, nt_errstr(result))); -- cgit