Univention Bugzilla – Attachment 7321 Details for
Bug 40059
No Login possible from one minute to another - smbd: nss_ldap: ldap_start_tls failed: Timed out
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Reproducer
40059_glic-NL.c (text/plain), 2.04 KB, created by
Philipp Hahn
on 2015-11-26 16:21:49 CET
(
hide
)
Description:
Reproducer
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2015-11-26 16:21:49 CET
Size:
2.04 KB
patch
obsolete
>/* > * <https://forge.univention.org/bugzilla/show_bug.cgi?id=40059> > */ >#define _GNU_SOURCE >#include <stdlib.h> >#include <stdio.h> >#include <unistd.h> >#include <pthread.h> >#include <grp.h> >#include <string.h> >#include <limits.h> >#include <stdarg.h> >#include <ctype.h> >#include <unistd.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <netdb.h> > >#define ARRAY_SIZE(a) ((sizeof (a)) / sizeof (*(a))) >#define BUFLEN 4096 > >// cyrus-sasl >int check(void) { > const char *addr = "0.0.0.0;7636"; > char hbuf[NI_MAXHOST]; > struct addrinfo hints, *ai = NULL; > int i, j; > > /* Parse the address */ > for (i = 0; addr[i] != '\0' && addr[i] != ';'; i++) { > if (i >= NI_MAXHOST) > return 3; > hbuf[i] = addr[i]; > } > hbuf[i] = '\0'; > > if (addr[i] == ';') > i++; > /* XXX: Do we need this check? */ > for (j = i; addr[j] != '\0'; j++) > if (!isdigit((int)(addr[j]))) > return 2; > > memset(&hints, 0, sizeof(hints)); > hints.ai_family = PF_UNSPEC; > hints.ai_socktype = SOCK_STREAM; > hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; > if (getaddrinfo(hbuf, &addr[i], &hints, &ai) != 0) > return 1; > > freeaddrinfo(ai); > > return 0; >} > >static pthread_t thread[10]; > >static void *run(void *data) { > unsigned int round, j; > > unsigned int self = (unsigned int)(unsigned long)data; > pthread_t tid = pthread_self(); > > printf("[%d] POSIX thread ID is %u\n", self, (unsigned int)tid); > > for (round = 0; round < 1000; round++) { > for (j = 0; j < 1000; j++) { > int i; > i = check(); > if (i) > break; > } > printf("%d\n", round); > > unsigned int usecs = (round * (unsigned int)tid) % 1000000; > usleep(usecs); > if (round % 10 == 0) > putchar('0' + (self % 10)); > } > > printf("[%d] end\n", self); > pthread_exit(NULL); >} > >int main(int argc, char *argv[], char *envp[]) { > pid_t pid = getpid(); > printf("pid=%d\n", pid); > > unsigned int t; > for (t = 0; t < ARRAY_SIZE(thread); t++) > pthread_create(&thread[t], NULL, run, (void *)(long)t); > > int ret = 0; > void *value_ptr; > for (t = 0; t < ARRAY_SIZE(thread); t++) > ret |= pthread_join(thread[t], &value_ptr); > > return ret; >} >/* :!gcc -O0 -g -Wall -lpthread % */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 40059
: 7321 |
7325