diff options
author | Christopher Faylor <me@cgf.cx> | 2003-02-10 22:43:29 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-02-10 22:43:29 +0000 |
commit | 407b8df695d94e88aa686d3ad84b0d6ccd363739 (patch) | |
tree | 2c1521fddf3a95c954419279a4330c4b5be3cf92 /winsup | |
parent | eff24ab9c5e61bc5e29df2a82f7f941ac9ce6927 (diff) | |
download | newlib-407b8df695d94e88aa686d3ad84b0d6ccd363739.zip newlib-407b8df695d94e88aa686d3ad84b0d6ccd363739.tar.gz newlib-407b8df695d94e88aa686d3ad84b0d6ccd363739.tar.bz2 |
* include/cygwin/in.h (in_attr_t): Define new type.
* include/arpa/inet.h (inet_addr): Change return type to in_addr_t.
(inet_lnaof): Ditto.
(inet_netof): Ditto.
(inet_network): Ditto.
* include/cygwin/types.h: Move many *_t typedefs here. Protect them with
ifdefs.
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Change ntsec_atts to
mode_t.
* security.cc (get_attribute_from_acl): Accept mode_t attribute.
(get_nt_attribute): Ditto.
(get_file_attribute): Ditto.
(get_nt_object_attribute): Ditto.
(get_object_attribute): Ditto.
* security.h: Reflect above changes.
* syscalls.cc (chown_worker): Change attrib to mode_t.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 21 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/include/arpa/inet.h | 16 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/in.h | 121 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/types.h | 139 | ||||
-rw-r--r-- | winsup/cygwin/security.cc | 10 | ||||
-rw-r--r-- | winsup/cygwin/security.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 4 |
8 files changed, 233 insertions, 84 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0eaea5f..2733b40 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,24 @@ +2003-02-10 Ralf Habacker <ralf.habacker@freenet.de> + + * include/cygwin/in.h (in_attr_t): Define new type. + * include/arpa/inet.h (inet_addr): Change return type to in_addr_t. + (inet_lnaof): Ditto. + (inet_netof): Ditto. + (inet_network): Ditto. + +2003-02-10 Christopher Faylor <cgf@redhat.com> + + * include/cygwin/types.h: Move many *_t typedefs here. Protect them + with ifdefs. + * fhandler_disk_file.cc (fhandler_disk_file::fstat): Change ntsec_atts to mode_t. + * security.cc (get_attribute_from_acl): Accept mode_t attribute. + (get_nt_attribute): Ditto. + (get_file_attribute): Ditto. + (get_nt_object_attribute): Ditto. + (get_object_attribute): Ditto. + * security.h: Reflect above changes. + * syscalls.cc (chown_worker): Change attrib to mode_t. + 2003-02-08 Christopher Faylor <cgf@redhat.com> * include/cygwin/version.h: Bump DLL minor number to 21. diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 21052e5..8deb7fb 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -174,7 +174,7 @@ fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc) oret = 0; else if (!(oret = open (pc, open_flags, 0))) { - int ntsec_atts = 0; + mode_t ntsec_atts = 0; /* If we couldn't open the file, try a "query open" with no permissions. This will allow us to determine *some* things about the file, at least. */ set_query_open (true); diff --git a/winsup/cygwin/include/arpa/inet.h b/winsup/cygwin/include/arpa/inet.h index dc144d6..284e98e 100644 --- a/winsup/cygwin/include/arpa/inet.h +++ b/winsup/cygwin/include/arpa/inet.h @@ -1,6 +1,6 @@ /* arpa/inet.h - Copyright 1997, 1998, 2001 Red Hat, Inc. + Copyright 1997, 1998, 2001, 2002, 2003 Red Hat, Inc. This file is part of Cygwin. @@ -19,13 +19,13 @@ extern "C" #endif #ifndef __INSIDE_CYGWIN_NET__ -unsigned long inet_addr (const char *); -int inet_aton (const char *, struct in_addr *); -unsigned long inet_lnaof (struct in_addr); -struct in_addr inet_makeaddr (unsigned long , unsigned long); -unsigned int inet_netof (struct in_addr); -unsigned int inet_network (const char *); -char *inet_ntoa (struct in_addr); +in_addr_t inet_addr (const char *); +int inet_aton (const char *, struct in_addr *); +in_addr_t inet_lnaof (struct in_addr); +struct in_addr inet_makeaddr (unsigned long , unsigned long); +in_addr_t inet_netof (struct in_addr); +in_addr_t inet_network (const char *); +char *inet_ntoa (struct in_addr); #endif #ifdef __cplusplus diff --git a/winsup/cygwin/include/cygwin/in.h b/winsup/cygwin/include/cygwin/in.h index ff69527..ed73b26 100644 --- a/winsup/cygwin/include/cygwin/in.h +++ b/winsup/cygwin/include/cygwin/in.h @@ -21,7 +21,8 @@ #include <cygwin/types.h> /* Standard well-defined IP protocols. */ -enum { +enum +{ IPPROTO_IP = 0, /* Dummy protocol for TCP */ IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ IPPROTO_IGMP = 2, /* Internet Gateway Management Protocol */ @@ -36,75 +37,77 @@ enum { IPPROTO_MAX }; +typedef uint16_t in_port_t; /* Standard well-known ports. *//* from winsup/include/netinet/in.h */ enum - { - IPPORT_ECHO = 7, /* Echo service. */ - IPPORT_DISCARD = 9, /* Discard transmissions service. */ - IPPORT_SYSTAT = 11, /* System status service. */ - IPPORT_DAYTIME = 13, /* Time of day service. */ - IPPORT_NETSTAT = 15, /* Network status service. */ - IPPORT_FTP = 21, /* File Transfer Protocol. */ - IPPORT_TELNET = 23, /* Telnet protocol. */ - IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */ - IPPORT_TIMESERVER = 37, /* Timeserver service. */ - IPPORT_NAMESERVER = 42, /* Domain Name Service. */ - IPPORT_WHOIS = 43, /* Internet Whois service. */ - IPPORT_MTP = 57, - - IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */ - IPPORT_RJE = 77, - IPPORT_FINGER = 79, /* Finger service. */ - IPPORT_TTYLINK = 87, - IPPORT_SUPDUP = 95, /* SUPDUP protocol. */ - - - IPPORT_EXECSERVER = 512, /* execd service. */ - IPPORT_LOGINSERVER = 513, /* rlogind service. */ - IPPORT_CMDSERVER = 514, - IPPORT_EFSSERVER = 520, - - /* UDP ports. */ - IPPORT_BIFFUDP = 512, - IPPORT_WHOSERVER = 513, - IPPORT_ROUTESERVER = 520, - - /* Ports less than this value are reserved for privileged processes. */ - IPPORT_RESERVED = 1024, - - /* Ports greater this value are reserved for (non-privileged) servers. */ - IPPORT_USERRESERVED = 5000 - }; - +{ + IPPORT_ECHO = 7, /* Echo service. */ + IPPORT_DISCARD = 9, /* Discard transmissions service. */ + IPPORT_SYSTAT = 11, /* System status service. */ + IPPORT_DAYTIME = 13, /* Time of day service. */ + IPPORT_NETSTAT = 15, /* Network status service. */ + IPPORT_FTP = 21, /* File Transfer Protocol. */ + IPPORT_TELNET = 23, /* Telnet protocol. */ + IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */ + IPPORT_TIMESERVER = 37, /* Timeserver service. */ + IPPORT_NAMESERVER = 42, /* Domain Name Service. */ + IPPORT_WHOIS = 43, /* Internet Whois service. */ + IPPORT_MTP = 57, + + IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */ + IPPORT_RJE = 77, + IPPORT_FINGER = 79, /* Finger service. */ + IPPORT_TTYLINK = 87, + IPPORT_SUPDUP = 95, /* SUPDUP protocol. */ + + + IPPORT_EXECSERVER = 512, /* execd service. */ + IPPORT_LOGINSERVER = 513, /* rlogind service. */ + IPPORT_CMDSERVER = 514, + IPPORT_EFSSERVER = 520, + + /* UDP ports. */ + IPPORT_BIFFUDP = 512, + IPPORT_WHOSERVER = 513, + IPPORT_ROUTESERVER = 520, + + /* Ports less than this value are reserved for privileged processes. */ + IPPORT_RESERVED = 1024, + + /* Ports greater this value are reserved for (non-privileged) servers. */ + IPPORT_USERRESERVED = 5000 +}; +typedef uint32_t in_addr_t; /* Internet address. */ -struct in_addr { - unsigned int s_addr; +struct in_addr +{ + unsigned int s_addr; }; /* Request struct for multicast socket ops */ struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ }; /* Structure describing an Internet (IP) socket address. */ #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ -struct sockaddr_in { - short int sin_family; /* Address family */ - unsigned short int sin_port; /* Port number */ - struct in_addr sin_addr; /* Internet address */ +struct sockaddr_in +{ + short int sin_family; /* Address family */ + unsigned short int sin_port; /* Port number */ + struct in_addr sin_addr; /* Internet address */ /* Pad to size of `struct sockaddr'. */ - unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - - sizeof(unsigned short int) - sizeof(struct in_addr)]; + unsigned chari __pad[__SOCK_SIZE__ - sizeof(short int) + - sizeof(unsigned short int) - sizeof(struct in_addr)]; }; #define sin_zero __pad /* for BSD UNIX comp. -FvK */ - /* * Definitions of the bits in an Internet address integer. * On subnets, host and network parts are found according @@ -167,22 +170,18 @@ struct sockaddr_in { #endif -/* - * IPv6 definitions as we start to include them. This is just - * a beginning dont get excited 8) - */ - +/* IPv6 definitions as we start to include them. This is just + a beginning dont get excited 8) */ struct in6_addr { - unsigned char s6_addr[16]; + unsigned char s6_addr[16]; }; struct sockaddr_in6 { - unsigned short sin6_family; - unsigned short sin6_port; - unsigned long sin6_flowinfo; - struct in6_addr sin6_addr; + unsigned short sin6_family; + unsigned short sin6_port; + unsigned long sin6_flowinfo; + struct in6_addr sin6_addr; }; - #endif /* _CYGWIN_IN_H */ diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h index 2064e8a..c4ba3a6 100644 --- a/winsup/cygwin/include/cygwin/types.h +++ b/winsup/cygwin/include/cygwin/types.h @@ -19,8 +19,18 @@ extern "C" #include <sys/sysmacros.h> -typedef struct timespec timespec_t, timestruc_t; - +#ifndef __timespec_t_defined +#define __timespec_t_defined +typedef struct timespec timespec_t; +#endif /*__timespec_t_defined*/ + +#ifndef __timestruc_t_defined +#define __timestruc_t_defined +typedef struct timespec timestruc_t; +#endif /*__timestruc_t_defined*/ + +#ifndef __off_t_defined +#define __off_t_defined typedef long __off32_t; typedef long long __off64_t; #ifdef __CYGWIN_USE_BIG_TYPES__ @@ -28,7 +38,10 @@ typedef __off64_t off_t; #else typedef __off32_t off_t; #endif +#endif /*__off_t_defined*/ +#ifndef __dev_t_defined +#define __dev_t_defined typedef short __dev16_t; typedef unsigned long __dev32_t; #ifdef __CYGWIN_USE_BIG_TYPES__ @@ -36,9 +49,15 @@ typedef __dev32_t dev_t; #else typedef __dev16_t dev_t; #endif +#endif /*__dev_t_defined*/ +#ifndef __blksize_t_defined +#define __blksize_t_defined typedef long blksize_t; +#endif /*__blksize_t_defined*/ +#ifndef __blkcnt_t_defined +#define __blkcnt_t_defined typedef long __blkcnt32_t; typedef long long __blkcnt64_t; #ifdef __CYGWIN_USE_BIG_TYPES__ @@ -46,18 +65,128 @@ typedef __blkcnt64_t blkcnt_t; #else typedef __blkcnt32_t blkcnt_t; #endif +#endif /*__blkcnt_t_defined*/ +#ifndef __uid_t_defined +#define __uid_t_defined typedef unsigned short __uid16_t; -typedef unsigned short __gid16_t; typedef unsigned long __uid32_t; -typedef unsigned long __gid32_t; #ifdef __CYGWIN_USE_BIG_TYPES__ typedef __uid32_t uid_t; -typedef __gid32_t gid_t; #else typedef __uid16_t uid_t; +#endif +#endif /*__uid_t_defined*/ + +#ifndef __gid_t_defined +#define __gid_t_defined +typedef unsigned short __gid16_t; +typedef unsigned long __gid32_t; +#ifdef __CYGWIN_USE_BIG_TYPES__ +typedef __gid32_t gid_t; +#else typedef __gid16_t gid_t; #endif +#endif /*__gid_t_defined*/ + +#ifndef __ino_t_defined +#define __ino_t_defined +#ifdef __CYGWIN_USE_BIG_TYPES1__ +typedef unsigned long long ino_t; +#else +typedef unsigned long ino_t; +#endif +#endif /*__ino_t_defined*/ + +#ifndef __BIT_TYPES_DEFINED +#define __BIT_TYPES_DEFINED__ 1 + +#ifndef __vm_offset_t +#define __vm_offset_t_defined +typedef unsigned long vm_offset_t; +#endif /*__vm_offset_t_defined*/ + +#ifndef __vm_size_t +#define __vm_size_t_defined +typedef unsigned long vm_size_t; +#endif /*__vm_size_t_defined*/ + +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +#endif +#ifndef __int16_t_defined +#define __int16_t_defined +typedef __int16_t int16_t; +#endif +#ifndef __int32_t_defined +#define __int32_t_defined +typedef __int32_t int32_t; +#endif +#ifndef __int64_t_defined +#define __int64_t_defined +typedef __int64_t int64_t; +#endif + +#ifndef __uint8_t_defined +#define __uint8_t_defined +typedef unsigned char uint8_t; +#endif +#ifndef __uint16_t_defined +#define __uint16_t_defined +typedef __uint16_t uint16_t; +#endif +#ifndef __uint32_t_defined +#define __uint32_t_defined +typedef __uint32_t uint32_t; +#endif +#ifndef __uint64_t_defined +#define __uint64_t_defined +typedef __uint64_t uint64_t; +#endif + +#ifndef __uint8_t_defined +#define __uint8_t_defined +typedef unsigned char u_int8_t; +#endif +#ifndef __uint16_t_defined +#define __uint16_t_defined +typedef __uint16_t u_int16_t; +#endif +#ifndef __uint32_t_defined +#define __uint32_t_defined +typedef __uint32_t u_int32_t; +#endif +#ifndef __uint64_t_defined +#define __uint64_t_defined +typedef __uint64_t u_int64_t; +#endif + +#ifndef __uintptr_t_defined +#define __uintptr_t_defined +typedef unsigned long uintptr_t; +#endif + +#ifndef __intptr_t_defined +#define __intptr_t_defined +typedef long intptr_t; +#endif + +#ifndef __register_t_defined +#define __register_t_defined +typedef __int32_t register_t; +#endif + +#ifndef __addr_t_defined +#define __addr_t_defined +typedef char *addr_t; +#endif + +#ifndef __mode_t_defined +#define __mode_t_defined +typedef unsigned mode_t; +#endif +#endif /*__BIT_TYPES_DEFINED*/ #if !defined(__INSIDE_CYGWIN__) || !defined(__cplusplus) diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 33b529d..35ac5cf 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1224,7 +1224,7 @@ write_sd (const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size) } static void -get_attribute_from_acl (int * attribute, PACL acl, PSID owner_sid, +get_attribute_from_acl (mode_t *attribute, PACL acl, PSID owner_sid, PSID group_sid, BOOL grp_member) { ACCESS_ALLOWED_ACE *ace; @@ -1319,7 +1319,7 @@ get_attribute_from_acl (int * attribute, PACL acl, PSID owner_sid, } static int -get_nt_attribute (const char *file, int *attribute, +get_nt_attribute (const char *file, mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { if (!wincap.has_security ()) @@ -1387,7 +1387,7 @@ get_nt_attribute (const char *file, int *attribute, int get_file_attribute (int use_ntsec, const char *file, - int *attribute, __uid32_t *uidret, __gid32_t *gidret) + mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { int res; @@ -1435,7 +1435,7 @@ get_file_attribute (int use_ntsec, const char *file, static int get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, - int *attribute, __uid32_t *uidret, __gid32_t *gidret) + mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { if (!wincap.has_security ()) return 0; @@ -1492,7 +1492,7 @@ get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, int get_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, - int *attribute, __uid32_t *uidret, __gid32_t *gidret) + mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { if (allow_ntsec) { diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index a99ac0a..9cbea2f 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -215,11 +215,11 @@ extern BOOL allow_smbntsec; /* File manipulation */ int __stdcall set_process_privileges (); -int __stdcall get_file_attribute (int, const char *, int *, +int __stdcall get_file_attribute (int, const char *, mode_t *, __uid32_t * = NULL, __gid32_t * = NULL); int __stdcall set_file_attribute (int, const char *, int); int __stdcall set_file_attribute (int, const char *, __uid32_t, __gid32_t, int); -int __stdcall get_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, int *, +int __stdcall get_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, mode_t *, __uid32_t * = NULL, __gid32_t * = NULL); LONG __stdcall read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size); LONG __stdcall write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size); diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index cf16433..59bb531 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -803,12 +803,12 @@ chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid) goto done; } - DWORD attrib = 0; + mode_t attrib = 0; if (win32_path.isdir ()) attrib |= S_IFDIR; res = get_file_attribute (win32_path.has_acls (), win32_path.get_win32 (), - (int *) &attrib); + &attrib); if (!res) res = set_file_attribute (win32_path.has_acls (), win32_path, uid, gid, attrib); |