diff options
author | Derrell Lipman <derrell@samba.org> | 2005-04-19 19:23:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:56:40 -0500 |
commit | 1d08b9013a67184b0ecfe8b013926128719b68a6 (patch) | |
tree | 48b05c1be341c1f5183abb7673435e1b0634058a /source3 | |
parent | 67e9fb7c7c61a337da7efb887e401dfaa828b7b5 (diff) | |
download | samba-1d08b9013a67184b0ecfe8b013926128719b68a6.tar.gz samba-1d08b9013a67184b0ecfe8b013926128719b68a6.tar.bz2 samba-1d08b9013a67184b0ecfe8b013926128719b68a6.zip |
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)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clifile.c | 4 | ||||
-rw-r--r-- | source3/libsmb/clikrb5.c | 4 | ||||
-rw-r--r-- | source3/libsmb/clirap2.c | 41 | ||||
-rw-r--r-- | source3/libsmb/libsmbclient.c | 31 | ||||
-rw-r--r-- | source3/libsmb/trustdom_cache.c | 2 | ||||
-rw-r--r-- | source3/libsmb/trusts_util.c | 3 |
6 files changed, 48 insertions, 37 deletions
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;i<count;i++) { @@ -543,10 +542,9 @@ int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (* } if (rdata) { if (res == 0 || res == ERRmoredata) { - int i, converter, count; + int i, count; fstring username; - p = rparam +WORDSIZE; - GETWORD(p, converter); + p = rparam + WORDSIZE + WORDSIZE; GETWORD(p, count); for (i=0,p=rdata; i<count; i++) { @@ -598,10 +596,9 @@ int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*f } if (rdata) { if (res == 0 || res == ERRmoredata) { - int i, converter, count; + int i, count; fstring groupname; - p = rparam +WORDSIZE; - GETWORD(p, converter); + p = rparam + WORDSIZE + WORDSIZE; GETWORD(p, count); for (i=0,p=rdata; i<count; i++) { @@ -800,7 +797,6 @@ int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char char username[RAP_USERNAME_LEN]; char userpw[RAP_UPASSWD_LEN]; pstring comment, homedir, logonscript; - int pwage, priv, flags; p = rparam + WORDSIZE; /* skip result */ GETWORD(p, converter); @@ -810,11 +806,11 @@ int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char GETSTRINGF(p, username, RAP_USERNAME_LEN); p++; /* pad byte */ GETSTRINGF(p, userpw, RAP_UPASSWD_LEN); - GETDWORD(p, pwage); /* password age */ - GETWORD(p, priv); /* 0=guest, 1=user, 2=admin */ + p += DWORDSIZE; /* skip password age */ + p += WORDSIZE; /* skip priv: 0=guest, 1=user, 2=admin */ GETSTRINGP(p, homedir, rdata, converter); GETSTRINGP(p, comment, rdata, converter); - GETWORD(p, flags); + p += WORDSIZE; /* skip flags */ GETSTRINGP(p, logonscript, rdata, converter); fn(username, comment, homedir, logonscript, cli); @@ -868,11 +864,10 @@ int cli_RNetUserEnum0(struct cli_state *cli, } if (rdata) { if (res == 0 || res == ERRmoredata) { - int i, converter, count; + int i, count; char username[RAP_USERNAME_LEN]; - p = rparam + WORDSIZE; /* skip result */ - GETWORD(p, converter); + p = rparam + WORDSIZE + WORDSIZE; /* skip result and converter */ GETWORD(p, count); for (i=0,p=rdata;i<count;i++) { @@ -1473,10 +1468,9 @@ BOOL cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 sty cli->rap_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;i<count;i++) { @@ -1943,14 +1936,14 @@ int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation, void ( res = GETRES(rparam); if (res == 0 || res == ERRmoredata) { - int rsize, converter; + int converter; pstring wsname, username, clitype_name; uint16 num_conns, num_opens, num_users; unsigned int sess_time, idle_time, user_flags; p = rparam + WORDSIZE; GETWORD(p, converter); - GETWORD(p, rsize); + p += WORDSIZE; /* skip rsize */ p = rdata; GETSTRINGP(p, wsname, rdata, converter); diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 3e8e604ab1..791427f249 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -646,13 +646,10 @@ SMBCSRV *smbc_server(SMBCCTX *context, * Force use of port 139 for first try if share is $IPC, empty, or * null, so browse lists can work */ - if (share == NULL || *share == '\0' || strcmp(share, "IPC$") == 0) - { + if (share == NULL || *share == '\0' || strcmp(share, "IPC$") == 0) { port_try_first = 139; port_try_next = 445; - } - else - { + } else { port_try_first = 445; port_try_next = 139; } @@ -1905,6 +1902,8 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname) fstring server, share, user, password, options; pstring workgroup; pstring path; + uint16 mode; + char *p; SMBCSRV *srv = NULL; SMBCFILE *dir = NULL; struct in_addr rem_ip; @@ -2197,6 +2196,7 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname) /* Now, list the files ... */ + p = path + strlen(path); pstrcat(path, "\\*"); if (cli_list(&srv->cli, 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)) { |