diff --git a/source/libsmb/clifile.c b/source/libsmb/clifile.c index 93492ec0822..5304f5d8cf5 100644 --- a/source/libsmb/clifile.c +++ b/source/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/source/libsmb/clikrb5.c b/source/libsmb/clikrb5.c index c35b53a9dd8..43252b94d83 100644 --- a/source/libsmb/clikrb5.c +++ b/source/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/source/libsmb/clirap2.c b/source/libsmb/clirap2.c index d8a85195502..b15ee1a63e2 100644 --- a/source/libsmb/clirap2.c +++ b/source/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/source/libsmb/trustdom_cache.c b/source/libsmb/trustdom_cache.c index e63acd18c4f..8c5fb4d9071 100644 --- a/source/libsmb/trustdom_cache.c +++ b/source/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/source/libsmb/trusts_util.c b/source/libsmb/trusts_util.c index b420e4fa081..aab0d7d1517 100644 --- a/source/libsmb/trusts_util.c +++ b/source/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)) {