Changeset 221 for branches/samba-3.3.x/source/lib
- Timestamp:
- May 24, 2009, 7:17:10 AM (16 years ago)
- Location:
- branches/samba-3.3.x/source/lib
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/lib/ctdbd_conn.c
r206 r221 1171 1171 1172 1172 /* 1173 This is used to canonicalize a ctdb_sock_addr structure. 1174 */ 1175 static void smbd_ctdb_canonicalize_ip(const struct sockaddr_storage *in, 1176 struct sockaddr_storage *out) 1177 { 1178 memcpy(out, in, sizeof (*out)); 1179 1180 #ifdef HAVE_IPV6 1181 if (in->ss_family == AF_INET6) { 1182 const char prefix[12] = { 0,0,0,0,0,0,0,0,0,0,0xff,0xff }; 1183 const struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)in; 1184 struct sockaddr_in *out4 = (struct sockaddr_in *)out; 1185 if (memcmp(&in6->sin6_addr, prefix, 12) == 0) { 1186 memset(out, 0, sizeof(*out)); 1187 #ifdef HAVE_SOCK_SIN_LEN 1188 out4->sin_len = sizeof(*out); 1189 #endif 1190 out4->sin_family = AF_INET; 1191 out4->sin_port = in6->sin6_port; 1192 memcpy(&out4->sin_addr, &in6->sin6_addr.s6_addr32[3], 4); 1193 } 1194 } 1195 #endif 1196 } 1197 1198 /* 1173 1199 * Register us as a server for a particular tcp connection 1174 1200 */ 1175 1201 1176 1202 NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn, 1177 const struct sockaddr_storage * server,1178 const struct sockaddr_storage * client,1203 const struct sockaddr_storage *_server, 1204 const struct sockaddr_storage *_client, 1179 1205 void (*release_ip_handler)(const char *ip_addr, 1180 1206 void *private_data), 1181 1207 void *private_data) 1182 1208 { 1183 struct sockaddr *sock = (struct sockaddr *)client;1184 1209 /* 1185 1210 * we still use ctdb_control_tcp for ipv4 … … 1188 1213 */ 1189 1214 struct ctdb_control_tcp p4; 1190 #ifdef HAVE_ IPV61215 #ifdef HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR 1191 1216 struct ctdb_control_tcp_addr p; 1192 1217 #endif 1193 1218 TDB_DATA data; 1194 1219 NTSTATUS status; 1220 struct sockaddr_storage client; 1221 struct sockaddr_storage server; 1195 1222 1196 1223 /* … … 1199 1226 SMB_ASSERT(conn->release_ip_handler == NULL); 1200 1227 1201 switch (sock->sa_family) { 1228 smbd_ctdb_canonicalize_ip(_client, &client); 1229 smbd_ctdb_canonicalize_ip(_server, &server); 1230 1231 switch (client.ss_family) { 1202 1232 case AF_INET: 1203 p4.dest = *(struct sockaddr_in *) server;1204 p4.src = *(struct sockaddr_in *) client;1233 p4.dest = *(struct sockaddr_in *)&server; 1234 p4.src = *(struct sockaddr_in *)&client; 1205 1235 data.dptr = (uint8_t *)&p4; 1206 1236 data.dsize = sizeof(p4); 1207 1237 break; 1208 #ifdef HAVE_ IPV61238 #ifdef HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR 1209 1239 case AF_INET6: 1210 p.dest.ip6 = *(struct sockaddr_in6 *) server;1211 p.src.ip6 = *(struct sockaddr_in6 *) client;1240 p.dest.ip6 = *(struct sockaddr_in6 *)&server; 1241 p.src.ip6 = *(struct sockaddr_in6 *)&client; 1212 1242 data.dptr = (uint8_t *)&p; 1213 1243 data.dsize = sizeof(p); -
branches/samba-3.3.x/source/lib/events.c
r206 r221 219 219 int selrtn, fd_set *read_fds, fd_set *write_fds) 220 220 { 221 bool fired = False; 222 struct fd_event *fde, *next; 223 224 /* Run all events that are pending, not just one (as we 225 did previously. */ 226 227 while (event_ctx->timed_events) { 228 struct timeval now; 229 GetTimeOfDay(&now); 230 231 if (timeval_compare( 232 &now, &event_ctx->timed_events->when) < 0) { 233 /* Nothing to do yet */ 234 DEBUG(11, ("run_events: Nothing to do\n")); 235 break; 236 } 221 struct fd_event *fde; 222 struct timeval now; 223 224 GetTimeOfDay(&now); 225 226 if ((event_ctx->timed_events != NULL) 227 && (timeval_compare(&now, &event_ctx->timed_events->when) >= 0)) { 237 228 238 229 DEBUG(10, ("Running event \"%s\" %lx\n", … … 245 236 event_ctx->timed_events->private_data); 246 237 247 fired = True; 248 } 249 250 if (fired) { 251 /* 252 * We might have changed the socket status during the timed 253 * events, return to run select again. 254 */ 255 return True; 238 return true; 256 239 } 257 240 … … 260 243 * No fd ready 261 244 */ 262 return f ired;263 } 264 265 for (fde = event_ctx->fd_events; fde; fde = next) {245 return false; 246 } 247 248 for (fde = event_ctx->fd_events; fde; fde = fde->next) { 266 249 uint16 flags = 0; 267 250 268 next = fde->next;269 251 if (FD_ISSET(fde->fd, read_fds)) flags |= EVENT_FD_READ; 270 252 if (FD_ISSET(fde->fd, write_fds)) flags |= EVENT_FD_WRITE; … … 272 254 if (flags & fde->flags) { 273 255 fde->handler(event_ctx, fde, flags, fde->private_data); 274 fired = True;275 } 276 } 277 278 return f ired;256 return true; 257 } 258 } 259 260 return false; 279 261 } 280 262 -
branches/samba-3.3.x/source/lib/interface.c
r206 r221 152 152 153 153 /**************************************************************************** 154 Return a pointer to the in_addr of the first IPv4 interface. 154 Return a pointer to the in_addr of the first IPv4 interface that's 155 not 0.0.0.0. 155 156 **************************************************************************/ 156 157 … … 160 161 161 162 for (i=local_interfaces;i ;i=i->next) { 162 if (i->ip.ss_family == AF_INET) { 163 if ((i->ip.ss_family == AF_INET) && 164 (!is_zero_ip_v4(((struct sockaddr_in *)&i->ip)->sin_addr))) 165 { 163 166 break; 164 167 } -
branches/samba-3.3.x/source/lib/ldap_debug_handler.c
r206 r221 20 20 #include "includes.h" 21 21 22 #if HAVE_LDAP 23 22 #if defined(HAVE_LDAP) && defined(HAVE_LBER_LOG_PRINT_FN) 24 23 static void samba_ldap_log_print_fn(LDAP_CONST char *data) 25 24 { 26 25 DEBUG(lp_ldap_debug_threshold(), ("[LDAP] %s", data)); 27 26 } 28 29 27 #endif 30 28 -
branches/samba-3.3.x/source/lib/replace/getifaddrs.c
r206 r221 85 85 int fd, i, n; 86 86 struct ifreq *ifr=NULL; 87 struct in_addr ipaddr;88 struct in_addr nmask;89 char *iname;90 87 struct ifaddrs *curif; 91 88 struct ifaddrs *lastif = NULL; … … 165 162 int fd, i, n; 166 163 struct ifreq *ifr=NULL; 167 struct in_addr ipaddr;168 struct in_addr nmask;169 char *iname;170 164 struct ifaddrs *curif; 171 165 struct ifaddrs *lastif = NULL; … … 266 260 struct ifconf ifc; 267 261 struct ifreq *ifr=NULL; 268 struct in_addr ipaddr;269 struct in_addr nmask;270 char *iname;271 262 struct ifaddrs *curif; 272 263 struct ifaddrs *lastif = NULL; -
branches/samba-3.3.x/source/lib/replace/libreplace_ld.m4
r206 r221 293 293 LIB_PATH_VAR=LD_LIBRARY_PATH 294 294 ;; 295 * netbsd*)295 *bsd*) 296 296 LIB_PATH_VAR=LD_LIBRARY_PATH 297 297 ;; -
branches/samba-3.3.x/source/lib/replace/libreplace_network.m4
r206 r221 8 8 9 9 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h arpa/inet.h) 10 AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h) 10 AC_CHECK_HEADERS(netinet/in_systm.h) 11 AC_CHECK_HEADERS([netinet/ip.h], [], [], [#ifdef HAVE_NETINET_IN_H 12 #include <netinet/in.h> 13 #endif 14 #ifdef HAVE_NETINET_IN_SYSTM_H 15 #include <netinet/in_systm.h> 16 #endif]) 17 AC_CHECK_HEADERS(netinet/tcp.h netinet/in_ip.h) 11 18 AC_CHECK_HEADERS(sys/sockio.h sys/un.h) 12 19 … … 347 354 #include <sys/types.h> 348 355 #include <netdb.h> 356 #include <netinet/in.h> 349 357 ], 350 358 [ -
branches/samba-3.3.x/source/lib/smbldap.c
r206 r221 582 582 int smb_ldap_start_tls(LDAP *ldap_struct, int version) 583 583 { 584 #ifdef LDAP_OPT_X_TLS 584 585 int rc; 586 #endif 585 587 586 588 if (lp_ldap_ssl() != LDAP_SSL_START_TLS) { -
branches/samba-3.3.x/source/lib/system.c
r206 r221 2272 2272 { 2273 2273 ssize_t len = 0; 2274 int stop = 0;2275 2274 DIR *dirp; 2276 2275 struct dirent *de; … … 2344 2343 int filedes = openat(fildes, path, oflag, mode); 2345 2344 if (filedes == -1) { 2346 DEBUG(10,("openat FAILED: fd: % s, path: %s, errno: %s\n",filedes,path,strerror(errno)));2345 DEBUG(10,("openat FAILED: fd: %d, path: %s, errno: %s\n",filedes,path,strerror(errno))); 2347 2346 if (errno == EINVAL) { 2348 2347 errno = ENOTSUP; -
branches/samba-3.3.x/source/lib/time.c
r206 r221 904 904 ret.tv_nsec = pst->st_atimensec; 905 905 return ret; 906 #elif defined(HAVE_STAT_ST_ATIME_N) 907 struct timespec ret; 908 ret.tv_sec = pst->st_atime; 909 ret.tv_nsec = pst->st_atime_n; 910 return ret; 911 #elif defined(HAVE_STAT_ST_UATIME) 912 struct timespec ret; 913 ret.tv_sec = pst->st_atime; 914 ret.tv_nsec = pst->st_uatime * 1000; 915 return ret; 916 #elif defined(HAVE_STAT_ST_ATIMESPEC) 917 return pst->st_atimespec; 906 918 #else 907 919 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT … … 920 932 #elif defined(HAVE_STAT_ST_ATIMENSEC) 921 933 pst->st_atime = ts.tv_sec; 922 pst->st_atimensec = ts.tv_nsec 934 pst->st_atimensec = ts.tv_nsec; 935 #elif defined(HAVE_STAT_ST_ATIME_N) 936 pst->st_atime = ts.tv_sec; 937 pst->st_atime_n = ts.tv_nsec; 938 #elif defined(HAVE_STAT_ST_UATIME) 939 pst->st_atime = ts.tv_sec; 940 pst->st_uatime = ts.tv_nsec / 1000; 941 #elif defined(HAVE_STAT_ST_ATIMESPEC) 942 pst->st_atimespec = ts; 923 943 #else 924 944 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT … … 944 964 ret.tv_nsec = pst->st_mtimensec; 945 965 return ret; 966 #elif defined(HAVE_STAT_ST_MTIME_N) 967 struct timespec ret; 968 ret.tv_sec = pst->st_mtime; 969 ret.tv_nsec = pst->st_mtime_n; 970 return ret; 971 #elif defined(HAVE_STAT_ST_UMTIME) 972 struct timespec ret; 973 ret.tv_sec = pst->st_mtime; 974 ret.tv_nsec = pst->st_umtime * 1000; 975 return ret; 976 #elif defined(HAVE_STAT_ST_MTIMESPEC) 977 return pst->st_mtimespec; 946 978 #else 947 979 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT … … 960 992 #elif defined(HAVE_STAT_ST_MTIMENSEC) 961 993 pst->st_mtime = ts.tv_sec; 962 pst->st_mtimensec = ts.tv_nsec 994 pst->st_mtimensec = ts.tv_nsec; 995 #elif defined(HAVE_STAT_ST_MTIME_N) 996 pst->st_mtime = ts.tv_sec; 997 pst->st_mtime_n = ts.tv_nsec; 998 #elif defined(HAVE_STAT_ST_UMTIME) 999 pst->st_mtime = ts.tv_sec; 1000 pst->st_umtime = ts.tv_nsec / 1000; 1001 #elif defined(HAVE_STAT_ST_MTIMESPEC) 1002 pst->st_mtimespec = ts; 963 1003 #else 964 1004 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT … … 984 1024 ret.tv_nsec = pst->st_ctimensec; 985 1025 return ret; 1026 #elif defined(HAVE_STAT_ST_CTIME_N) 1027 struct timespec ret; 1028 ret.tv_sec = pst->st_ctime; 1029 ret.tv_nsec = pst->st_ctime_n; 1030 return ret; 1031 #elif defined(HAVE_STAT_ST_UCTIME) 1032 struct timespec ret; 1033 ret.tv_sec = pst->st_ctime; 1034 ret.tv_nsec = pst->st_uctime * 1000; 1035 return ret; 1036 #elif defined(HAVE_STAT_ST_CTIMESPEC) 1037 return pst->st_ctimespec; 986 1038 #else 987 1039 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT … … 1000 1052 #elif defined(HAVE_STAT_ST_CTIMENSEC) 1001 1053 pst->st_ctime = ts.tv_sec; 1002 pst->st_ctimensec = ts.tv_nsec 1054 pst->st_ctimensec = ts.tv_nsec; 1055 #elif defined(HAVE_STAT_ST_CTIME_N) 1056 pst->st_ctime = ts.tv_sec; 1057 pst->st_ctime_n = ts.tv_nsec; 1058 #elif defined(HAVE_STAT_ST_UCTIME) 1059 pst->st_ctime = ts.tv_sec; 1060 pst->st_uctime = ts.tv_nsec / 1000; 1061 #elif defined(HAVE_STAT_ST_CTIMESPEC) 1062 pst->st_ctimespec = ts; 1003 1063 #else 1004 1064 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT -
branches/samba-3.3.x/source/lib/util_file.c
r206 r221 102 102 ****************************************************************************/ 103 103 104 static char *file_pload(c har *syscmd, size_t *size)104 static char *file_pload(const char *syscmd, size_t *size) 105 105 { 106 106 int fd, n; … … 352 352 ****************************************************************************/ 353 353 354 char **file_lines_pload(c har *syscmd, int *numlines)354 char **file_lines_pload(const char *syscmd, int *numlines) 355 355 { 356 356 char *p; -
branches/samba-3.3.x/source/lib/util_seaccess.c
r206 r221 150 150 151 151 /* 152 the main entry point for access checking. 152 The main entry point for access checking. If returning ACCESS_DENIED 153 this function returns the denied bits in the uint32_t pointed 154 to by the access_granted pointer. 153 155 */ 154 156 NTSTATUS se_access_check(const struct security_descriptor *sd, … … 239 241 done: 240 242 if (bits_remaining != 0) { 243 *access_granted = bits_remaining; 241 244 return NT_STATUS_ACCESS_DENIED; 242 245 } -
branches/samba-3.3.x/source/lib/util_tdb.c
r206 r221 1098 1098 /* parent */ 1099 1099 1100 DEBUG(10, ("tdb_validate: fork succeeded, child PID = %d\n",child_pid)); 1100 DEBUG(10, ("tdb_validate: fork succeeded, child PID = %u\n", 1101 (unsigned int)child_pid)); 1101 1102 1102 1103 DEBUG(10, ("tdb_validate: waiting for child to finish...\n")); … … 1114 1115 if (wait_pid != child_pid) { 1115 1116 DEBUG(1, ("tdb_validate: waitpid returned pid %d, " 1116 "but %d was expected\n", wait_pid, child_pid)); 1117 "but %u was expected\n", wait_pid, 1118 (unsigned int)child_pid)); 1117 1119 goto done; 1118 1120 }
Note:
See TracChangeset
for help on using the changeset viewer.