From 1d08b9013a67184b0ecfe8b013926128719b68a6 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Tue, 19 Apr 2005 19:23:49 +0000 Subject: r6392: - Fixes bug 2564: when smbc_opendir() was called with a file rather than a directory, the errno returned could end up as ENOENT rather than ENOTDIR. - Fixes some compiler warnings which showed up on IRIX, as reported by James Peach. (This used to be commit 615a62b21f8d2f7f97bde2f166ddd6849d39b95c) --- source3/libsmb/clifile.c | 4 ++-- source3/libsmb/clikrb5.c | 4 ++-- source3/libsmb/clirap2.c | 41 +++++++++++++++++------------------------ source3/libsmb/libsmbclient.c | 31 ++++++++++++++++++++++++++----- source3/libsmb/trustdom_cache.c | 2 +- source3/libsmb/trusts_util.c | 3 --- 6 files changed, 48 insertions(+), 37 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 93492ec082..5304f5d8cf 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -266,8 +266,8 @@ BOOL cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbu sbuf->st_ctime = interpret_long_date(rdata + 16); /* time of last change */ sbuf->st_atime = interpret_long_date(rdata + 24); /* time of last access */ sbuf->st_mtime = interpret_long_date(rdata + 32); /* time of last modification */ - sbuf->st_uid = IVAL(rdata,40); /* user ID of owner */ - sbuf->st_gid = IVAL(rdata,48); /* group ID of owner */ + sbuf->st_uid = (uid_t) IVAL(rdata,40); /* user ID of owner */ + sbuf->st_gid = (gid_t) IVAL(rdata,48); /* group ID of owner */ sbuf->st_mode |= unix_filetype_from_wire(IVAL(rdata, 56)); #if defined(HAVE_MAKEDEV) { diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c index c35b53a9dd..43252b94d8 100644 --- a/source3/libsmb/clikrb5.c +++ b/source3/libsmb/clikrb5.c @@ -396,7 +396,7 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context, /* cope with ticket being in the future due to clock skew */ if ((unsigned)credsp->times.starttime > time(NULL)) { time_t t = time(NULL); - int time_offset =(unsigned)credsp->times.starttime-t; + int time_offset =(int)((unsigned)credsp->times.starttime-t); DEBUG(4,("ads_krb5_mk_req: Advancing clock by %d seconds to cope with clock skew\n", time_offset)); krb5_set_real_time(context, t + time_offset + 1, 0); } @@ -405,7 +405,7 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context, creds_ready = True; } - DEBUG(10,("ads_krb5_mk_req: Ticket (%s) in ccache (%s) is valid until: (%s - %d)\n", + DEBUG(10,("ads_krb5_mk_req: Ticket (%s) in ccache (%s) is valid until: (%s - %u)\n", principal, krb5_cc_default_name(context), http_timestring((unsigned)credsp->times.endtime), (unsigned)credsp->times.endtime)); diff --git a/source3/libsmb/clirap2.c b/source3/libsmb/clirap2.c index d8a8519550..b15ee1a63e 100644 --- a/source3/libsmb/clirap2.c +++ b/source3/libsmb/clirap2.c @@ -369,10 +369,9 @@ int cli_RNetGroupEnum0(struct cli_state *cli, if (rdata) { if (res == 0 || res == ERRmoredata) { - int i, converter, count; + int i, count; - p = rparam + WORDSIZE; /* skip result */ - GETWORD(p, converter); + p = rparam + WORDSIZE + WORDSIZE; /* skip result and converter */ GETWORD(p, count); for (i=0,p=rdata;irap_error = res; if (res == 0 || res == ERRmoredata) { - int i, converter, count; + int i, count; - p = rparam + WORDSIZE; - GETWORD(p, converter); + p = rparam + WORDSIZE + WORDSIZE; GETWORD(p, count); p = rdata; @@ -1798,10 +1792,9 @@ int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const ch if (rdata) { if (res == 0 || res == ERRmoredata) { - int i, converter, count; + int i, count; - p = rparam + WORDSIZE; /* skip result */ - GETWORD(p, converter); + p = rparam + WORDSIZE + WORDSIZE; /* skip result and converter */ GETWORD(p, count); for (i=0,p=rdata;icli, path, aDIR | aSYSTEM | aHIDDEN, dir_list_fn, @@ -2207,6 +2207,27 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname) SAFE_FREE(dir); } errno = smbc_errno(context, &srv->cli); + + if (errno == EINVAL) { + /* + * See if they asked to opendir something + * other than a directory. If so, the + * converted error value we got would have + * been EINVAL rather than ENOTDIR. + */ + *p = '\0'; /* restore original path */ + + if (smbc_getatr(context, srv, path, + &mode, NULL, + NULL, NULL, NULL, + NULL) && + ! IS_DOS_DIR(mode)) { + + /* It is. Correct the error value */ + errno = ENOTDIR; + } + } + return NULL; } diff --git a/source3/libsmb/trustdom_cache.c b/source3/libsmb/trustdom_cache.c index e63acd18c4..8c5fb4d907 100644 --- a/source3/libsmb/trustdom_cache.c +++ b/source3/libsmb/trustdom_cache.c @@ -320,7 +320,7 @@ void update_trustdom_cache( void ) if ( (last_check = trustdom_cache_fetch_timestamp()) == 0 ) trustdom_cache_store_timestamp(0, now+TRUSTDOM_UPDATE_INTERVAL); - time_diff = now - last_check; + time_diff = (int) (now - last_check); if ( (time_diff > 0) && (time_diff < TRUSTDOM_UPDATE_INTERVAL) ) { DEBUG(10,("update_trustdom_cache: not time to update trustdom_cache yet\n")); diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c index b420e4fa08..aab0d7d151 100644 --- a/source3/libsmb/trusts_util.c +++ b/source3/libsmb/trusts_util.c @@ -104,11 +104,8 @@ NTSTATUS trust_pw_find_change_and_store_it(struct cli_state *cli, const char *domain) { unsigned char old_trust_passwd_hash[16]; - char *up_domain; uint32 sec_channel_type = 0; - up_domain = talloc_strdup(mem_ctx, domain); - if (!secrets_fetch_trust_account_password(domain, old_trust_passwd_hash, NULL, &sec_channel_type)) { -- cgit