* mkgroup.c (usage): Move info message that this /etc/group isn't really
required anymore more to the top of the usage output.
* mkpasswd.c (usage): Ditto for /etc/passwd. Drop old text from output.
* cygheap.h (class cygheap_domain_info): Remove lowest_tdo_posix_offset.
* ldap.cc (cyg_ldap::fetch_posix_offset_for_domain): Return UINT32_MAX
in case of error.
* security.h (PRIMARY_POSIX_OFFSET): Define.
(NOACCESS_POSIX_OFFSET): Define.
(UNUSABLE_POSIX_OFFSET): Define.
* uinfo.cc (cygheap_domain_info::init): Drop initializing
lowest_tdo_posix_offset.
(pwdgrp::fetch_account_from_file): Set PosixOffset to either
UNUSABLE_POSIX_OFFSET or NOACCESS_POSIX_OFFSET in case we don't get a
sensible offset from AD. Explain why. Drop setting ch
lowest_tdo_posix_offset.
(pwdgrp::fetch_account_from_windows): Replace constant 0x100000 with
PRIMARY_POSIX_OFFSET throughout.
* fhandler_socket.cc (fhandler_socket::send_internal): Fix value of
out_len when tweaking the last buffer so out_len is correct in a
subsequent if expression.
* thread.cc (pthread::create): Handle stackaddr as upper bound address.
Add comment.
(pthread_attr_setstack): Store upper bound address in stackaddr.
Explain why.
(pthread_attr_getstack): Handle stackaddr as upper bound address.
Add comment.
(pthread_attr_setstackaddr): Add comment.
(pthread_attr_getstackaddr): Add comment.
(pthread_attr_getstacksize): Return default stacksize if stacksize has
not been set by the application, just as on Linux. Add comment.
(pthread_getattr_np): Store upper bound address in stackaddr. Explain
why.
* include/pthread.h: Remove outdated comment.
(pthread_attr_getstackaddr): Mark as deprecated, as on Linux.
(pthread_attr_setstackaddr): Ditto.
* sigproc.cc (sigproc_init): Set aside more buffer space for signal pipes.
(sig_send): Retry WriteFiles which fail when there is no error but packbytes
have not been sent.
* uinfo.cc (cygheap_domain_info::init): Correctly set
lowest_tdo_posix_offset to UNIX_POSIX_OFFSET.
(fetch_posix_offset): Redesign to fake a POSIX offset in all cases
where we can't fetch a non-0 POSIX offset from our primary domain.
* thread.cc (pthread_mutex::pthread_mutex): Change default type
to PTHREAD_MUTEX_NORMAL.
(pthread_mutex::unlock): Return EPERM if the mutex has no owner and
the mutex type is PTHREAD_MUTEX_ERRORCHECK, as on Linux.
(pthread_mutexattr::pthread_mutexattr): Ditto.
(pthread_mutex_unlock): Do not fail if mutex is a normal mutex
initializer.
* include/pthread.h (PTHREAD_MUTEX_INITIALIZER): Redefine as
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP.
Richard Earnshaw [Fri, 11 Jul 2014 09:10:50 +0000 (09:10 +0000)]
[aarch64] Add memchr.
2014-07-11 K�vin Petit <kevin.petit@arm.com>
* libc/machine/aarch64/memchr.S: New file.
* libc/machine/aarch64/memchr-stub.c: New file.
* libc/machine/aarch64/Makefile.am: Add the new files.
* libc/machine/aarch64/Makefile.in: Regenerated.
* thread.cc (pthread::create): Use PTHREAD_DEFAULT_STACKSIZE stacksize
if attr.stacksize is 0.
(pthread_attr::pthread_attr): Initialize stacksize to 0 to align more
closely to Linux.
(pthread_attr_getstack): Fix incorrect stackaddr computation. Return
stackaddr just like pthread_attr_getstackaddr. Remove slightly off
comment.
(pthread_attr_getstackaddr): Remove slightly off comment.
(pthread_getattr_np): Return stackaddr and stacksize based on the full
allocated stackarea.
* fhandler_socket.cc (fhandler_socket::send_internal): Improve loop to
write streams in chunks of wmem() bytes to raise performance when
writing small buffers. Rename variables and add comments to help
understanding the code in years to come.
Corinna Vinschen [Wed, 25 Jun 2014 09:10:50 +0000 (09:10 +0000)]
* autoload.cc (ldap_search_sW): Replace ldap_search_stW.
(LdapMapErrorToWin32): Import.
* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Accommodate
change to cyg_ldap::open.
* ldap.cc (CYG_LDAP_TIMEOUT): Remove.
(CYG_LDAP_ENUM_TIMEOUT): Remove.
(def_tv): Remove.
(enum_tv): Remove.
(cyg_ldap::map_ldaperr_to_errno): New method to map LDAP error codes to
POSIX errno codes. Explicitly map LDAP_NO_RESULTS_RETURNED to ENMFILE.
(cyg_ldap::wait): Ditto.
(struct cyg_ldap_init): New struct.
(cyg_ldap::connect_ssl): Return ULONG. Drop setting LDAP_OPT_TIMELIMIT.
Add call to ldap_search_sW to fetch root DSE.
(cyg_ldap::connect_non_ssl): Ditto.
(ldap_init_thr): New static thread function.
(cyg_ldap::connect): New method to call connect_ssl/connect_non_ssl in
an interruptible cygthread.
(struct cyg_ldap_search): New struct.
(cyg_ldap::search_s): New method to perform generic synchronous search.
(ldap_search_thr): New static thread function.
(cyg_ldap::search): New method to call search_s in an interruptible
cygthread.
(struct cyg_ldap_next_page): New struct.
(cyg_ldap::next_page_s): New method to perform generic synchronous
paged search.
(ldap_next_page_thr): New static thread function.
(cyg_ldap::next_page): New method to call next_page_s in an
interruptible cygthread.
(cyg_ldap::open): Return POSIX errno. Call connect method.
(cyg_ldap::fetch_ad_account): Call search method rather than
ldap_search_stW.
(cyg_ldap::enumerate_ad_accounts): Return POSIX errno. Use infinite
timeout in call to ldap_search_init_pageW.
(cyg_ldap::next_account): Return POSIX errno. Call next_page method
rather than ldap_get_next_page_s.
(cyg_ldap::fetch_posix_offset_for_domain): Call search method rather
than ldap_search_stW.
(cyg_ldap::fetch_unix_sid_from_ad): Ditto.
(cyg_ldap::fetch_unix_name_from_rfc2307): Ditto.
* ldap.h (class cyg_ldap): Accommodate aforementioned changes.
* passwd.cc (pg_ent::enumerate_ad): Ditto. Break search if one of
cyg_ldap::enumerate_ad_accounts or cldap.next_account returns with
an error code other than ENMFILE.
* sec_helper.cc (cygpsid::get_id): Accommodate change to cyg_ldap::open.
* uinfo.cc (fetch_posix_offset): Ditto.
Corinna Vinschen [Mon, 23 Jun 2014 14:05:16 +0000 (14:05 +0000)]
* mount.cc (fs_info::update): Define dir in the outermost scope to avoid
accessing out-of-scope value (CID 60027). Always initialize attr to
upath (CID 60113).
Corinna Vinschen [Mon, 23 Jun 2014 09:09:54 +0000 (09:09 +0000)]
* ldap.cc (CYG_LDAP_TIMEOUT): Set to 5 secs.
(CYG_LDAP_ENUM_TIMEOUT): New timeout value for enumeration only. Set
to 60 secs.
(CYG_LDAP_ENUM_PAGESIZE): Define as number of entries per single
search page. Set to 100. Use throughout.
(def_tv): Rename from tv. Use throughout.
(enum_tv): New variable. Use in call to ldap_get_next_page_s.
Corinna Vinschen [Wed, 18 Jun 2014 17:41:52 +0000 (17:41 +0000)]
* ldap.cc (CYG_LDAP_TIMEOUT): Define as timeout value. Set to 30 secs
for now. Use throughout.
* uinfo.cc (colon_to_semicolon): New local function.
(pwdgrp::fetch_account_from_windows): Convert all colons in AD gecos
entry to commas.
Richard Earnshaw [Wed, 11 Jun 2014 10:42:54 +0000 (10:42 +0000)]
* libc/machine/aarch64/strchrnul.S: New file.
* libc/machine/aarch64/strchrnul-stub.c: New file.
* libc/machine/aarch64/Makefile.am: Add them to build list.
* libc/machine/aarch64/Makefile.in: Regenerated.
Richard Earnshaw [Tue, 10 Jun 2014 14:04:31 +0000 (14:04 +0000)]
* libc/machine/aarch64/strchr.S: New file
* libc/machine/aarch64/strchr-stub.c: New file
* libc/machine/aarch64/Makefile.am: Add them to build list.
* libc/machine/aarch64/Makefile.in: Regenerated.
DJ Delorie [Tue, 10 Jun 2014 03:09:35 +0000 (03:09 +0000)]
* configure.host (default_newlib_nano_malloc): New.
(msp430): Set it.
* configure.in (newlib_nano_malloc): Leave unset if not set by
the user.
* configure: Regenerate.
* libc/configure.in (NEWLIB_NANO_MALLOC): Set after running
configure.host.
(newlib_nano_malloc): Leave unset if not set by the user.
* libc/configure: Regenerate.
Corinna Vinschen [Fri, 23 May 2014 10:29:11 +0000 (10:29 +0000)]
* autoload.cc (ldap_memfreeW): Remove.
(ldap_msgfree): Import.
* ldap.cc: Throughout, use ldap_msgfree to free LDAPMessage memory,
rather than ldap_memfreeW.
(cyg_ldap::next_account): Immediately abandon search when quiting from
search.
Corinna Vinschen [Thu, 22 May 2014 20:07:25 +0000 (20:07 +0000)]
* autoload.cc (ldap_abandon): Remove.
(ldap_count_entries): Import.
(ldap_get_next_page_s): Import.
(ldap_result): Remove.
(ldap_searchW): Remove.
(ldap_search_abandon_page): Import.
(ldap_search_init_pageW): Import.
* ldap.cc (cyg_ldap::close): Use ldap_search_abandon_page to abandon
search. Reset srch_id, srch_msg and srch_entry.
(cyg_ldap::enumerate_ad_accounts): Use paged search to overcome server
side search result set restriction.
(cyg_ldap::next_account): Ditto.
* ldap.h (class cyg_ldap): Add members srch_id, srch_msg and srch_entry.
Remove member msg_id.
(cyg_ldap::cyg_ldap): Change initialization accordingly.
Corinna Vinschen [Thu, 22 May 2014 14:50:24 +0000 (14:50 +0000)]
* ldap.cc (cyg_ldap::fetch_ad_account): Take additional domain string
parameter. Convert into likely rootDSE string if not NULL, and use in
subsequent call to ldap_search_stW. Add comment to explain that this
is not the exactly correct solution.
* ldap.h (cyg_ldap::fetch_ad_account): Change prototype accordingly.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Always use loc_ldap
in call to fetch_posix_offset to make sure we're fetchoinmg the posix
offsets from *our* domain controller. Only set domain variable to
non-NULL if the account is from a trusted domain. Use domain in call
to cyg_ldap::fetch_ad_account.
Corinna Vinschen [Thu, 22 May 2014 09:45:17 +0000 (09:45 +0000)]
* libc/bsdlib.cc (forkpty): Close master and slave if fork fails to
avoid resource leak (CID 59997).
* libc/fts.c: Update to FreeBSD version 1.39 (CID 59947).
* libc/minires.c (minires_get_search): Fix out-of-bounds read from
words array (CID 59937).
Corinna Vinschen [Tue, 20 May 2014 10:21:34 +0000 (10:21 +0000)]
* scandir.cc (scandir): Assume namelist is always valid, per POSIX.
(CID 60021).
* sec_auth.cc (cygwin_logon_user): Securely erase password copy.
(lsaprivkeyauth): Avoid trying to dereference data if no key is stored
in the registry (CID 60122). Securely erase passwords after usage.
Corinna Vinschen [Mon, 19 May 2014 15:57:22 +0000 (15:57 +0000)]
* net.cc (call_gaa): Fix setting pa_ret pointer in case of an error
from GetAdaptersAddresses (CID 60218).
(get_ifs): Add missing braces in AF_INET6 case which broke netmask
computation. Break out of loop if prefix gets <= 0 (CID 59939).
Corinna Vinschen [Mon, 19 May 2014 09:49:15 +0000 (09:49 +0000)]
* bsd_helper.cc (ipcexit_creat_hookthread): Delete shs to make
Coverity happy (CID 59993).
* transport_pipes.cc (transport_layer_pipes::listen): Make listen_pipe
and connect_pipe statics to make Coverity happy (CID 60010/60011).