Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
72b78669
Commit
72b78669
authored
Feb 17, 2024
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ldap: Import upstream release 2.5.17.
parent
b15d0120
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
127 deletions
+68
-127
string.h
libs/ldap/include/ac/string.h
+3
-3
getdn.c
libs/ldap/libldap/getdn.c
+8
-0
open.c
libs/ldap/libldap/open.c
+1
-0
url.c
libs/ldap/libldap/url.c
+4
-0
util-int.c
libs/ldap/libldap/util-int.c
+52
-124
No files found.
libs/ldap/include/ac/string.h
View file @
72b78669
...
@@ -58,7 +58,7 @@ LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
...
@@ -58,7 +58,7 @@ LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
#elif !defined(_WIN32)
#elif !defined(_WIN32)
/* some systems fail to declare strdup */
/* some systems fail to declare strdup */
/* Windows does not require this declaration */
/* Windows does not require this declaration */
LDAP_LIBC_F
(
char
*
)
(
strdup
)
(
);
LDAP_LIBC_F
(
char
*
)
(
strdup
)
LDAP_P
((
const
char
*
s
)
);
#endif
#endif
/*
/*
...
@@ -68,8 +68,8 @@ LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
...
@@ -68,8 +68,8 @@ LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str,
/* we don't want these declared for Windows or Mingw */
/* we don't want these declared for Windows or Mingw */
#ifndef _WIN32
#ifndef _WIN32
int
(
strcasecmp
)(
);
LDAP_LIBC_F
(
int
)
(
strcasecmp
)
LDAP_P
((
const
char
*
s1
,
const
char
*
s2
)
);
int
(
strncasecmp
)(
);
LDAP_LIBC_F
(
int
)
(
strncasecmp
)
LDAP_P
((
const
char
*
s1
,
const
char
*
s2
,
size_t
n
)
);
#endif
#endif
#ifndef SAFEMEMCPY
#ifndef SAFEMEMCPY
...
...
libs/ldap/libldap/getdn.c
View file @
72b78669
...
@@ -2562,6 +2562,8 @@ rdn2strlen( LDAPRDN rdn, unsigned flags, ber_len_t *len,
...
@@ -2562,6 +2562,8 @@ rdn2strlen( LDAPRDN rdn, unsigned flags, ber_len_t *len,
l
+=
vl
;
l
+=
vl
;
}
}
}
}
if
(
!
iAVA
)
return
(
-
1
);
/* RDN ::= SET SIZE (1..MAX) OF AVA */
*
len
=
l
;
*
len
=
l
;
...
@@ -2635,6 +2637,8 @@ rdn2DCEstrlen( LDAPRDN rdn, unsigned flags, ber_len_t *len )
...
@@ -2635,6 +2637,8 @@ rdn2DCEstrlen( LDAPRDN rdn, unsigned flags, ber_len_t *len )
l
+=
vl
;
l
+=
vl
;
}
}
}
}
if
(
!
iAVA
)
return
(
-
1
);
/* RDN ::= SET SIZE (1..MAX) OF AVA */
*
len
=
l
;
*
len
=
l
;
...
@@ -2716,6 +2720,8 @@ rdn2UFNstrlen( LDAPRDN rdn, unsigned flags, ber_len_t *len )
...
@@ -2716,6 +2720,8 @@ rdn2UFNstrlen( LDAPRDN rdn, unsigned flags, ber_len_t *len )
l
+=
vl
;
l
+=
vl
;
}
}
}
}
if
(
!
iAVA
)
return
(
-
1
);
/* RDN ::= SET SIZE (1..MAX) OF AVA */
*
len
=
l
;
*
len
=
l
;
...
@@ -2794,6 +2800,8 @@ rdn2ADstrlen( LDAPRDN rdn, unsigned flags, ber_len_t *len )
...
@@ -2794,6 +2800,8 @@ rdn2ADstrlen( LDAPRDN rdn, unsigned flags, ber_len_t *len )
l
+=
vl
;
l
+=
vl
;
}
}
}
}
if
(
!
iAVA
)
return
(
-
1
);
/* RDN ::= SET SIZE (1..MAX) OF AVA */
*
len
=
l
;
*
len
=
l
;
...
...
libs/ldap/libldap/open.c
View file @
72b78669
...
@@ -543,6 +543,7 @@ ldap_int_open_connection(
...
@@ -543,6 +543,7 @@ ldap_int_open_connection(
LDAP_MUTEX_UNLOCK
(
&
lo
->
ldo_mutex
);
LDAP_MUTEX_UNLOCK
(
&
lo
->
ldo_mutex
);
}
}
ber_int_sb_close
(
conn
->
lconn_sb
);
ber_int_sb_close
(
conn
->
lconn_sb
);
ber_int_sb_destroy
(
conn
->
lconn_sb
);
return
-
1
;
return
-
1
;
}
}
}
}
...
...
libs/ldap/libldap/url.c
View file @
72b78669
...
@@ -867,6 +867,10 @@ ldap_url_parse_ext( LDAP_CONST char *url_in, LDAPURLDesc **ludpp, unsigned flags
...
@@ -867,6 +867,10 @@ ldap_url_parse_ext( LDAP_CONST char *url_in, LDAPURLDesc **ludpp, unsigned flags
}
}
if
(
enclosed
)
{
if
(
enclosed
)
{
if
(
!
*
url
)
{
LDAP_FREE
(
url
);
return
LDAP_URL_ERR_BADENCLOSURE
;
}
p
=
&
url
[
strlen
(
url
)
-
1
];
p
=
&
url
[
strlen
(
url
)
-
1
];
if
(
*
p
!=
'>'
)
{
if
(
*
p
!=
'>'
)
{
...
...
libs/ldap/libldap/util-int.c
View file @
72b78669
...
@@ -182,116 +182,65 @@ static int _ldap_pvt_gt_subs;
...
@@ -182,116 +182,65 @@ static int _ldap_pvt_gt_subs;
* This is pretty clunky.
* This is pretty clunky.
*/
*/
static
LARGE_INTEGER
_ldap_pvt_gt_freq
;
static
LARGE_INTEGER
_ldap_pvt_gt_freq
;
static
LARGE_INTEGER
_ldap_pvt_gt_prev
;
static
LARGE_INTEGER
_ldap_pvt_gt_start_count
;
static
int
_ldap_pvt_gt_offset
;
static
long
_ldap_pvt_gt_start_sec
;
static
long
_ldap_pvt_gt_start_nsec
;
static
double
_ldap_pvt_gt_nanoticks
;
#define SEC_TO_UNIX_EPOCH 11644473600LL
#define SEC_TO_UNIX_EPOCH 11644473600LL
#define TICKS_PER_SECOND 10000000
#define TICKS_PER_SECOND 10000000
#define BILLION 1000000000L
L
#define BILLION 1000000000L
static
int
static
int
ldap_pvt_gettimensec
(
int
*
sec
)
ldap_pvt_gettimensec
(
long
*
sec
)
{
{
LARGE_INTEGER
count
;
LARGE_INTEGER
count
;
LARGE_INTEGER
freq
;
int
nsec
;
QueryPerformanceCounter
(
&
count
);
QueryPerformanceFrequency
(
&
freq
);
/* It shouldn't ever go backwards, but multiple CPUs might
* be able to hit in the same tick.
*/
LDAP_MUTEX_LOCK
(
&
ldap_int_gettime_mutex
);
/* We assume Windows has at least a vague idea of
/* We assume Windows has at least a vague idea of
* when a second begins. So we align our nanosecond count
* when a second begins. So we align our nanosecond count
* with the Windows millisecond count using this offset.
* with the Windows millisecond count.
* We retain the submillisecond portion of our own count.
*
* Note - this also assumes that the relationship between
* the PerformanceCounter and SystemTime stays constant;
* that assumption breaks if the SystemTime is adjusted by
* an external action.
*/
*/
if
(
!
_ldap_pvt_gt_freq
.
QuadPart
)
{
if
(
freq
.
QuadPart
!=
_ldap_pvt_gt_freq
.
QuadPart
)
{
LARGE_INTEGER
c2
;
ULARGE_INTEGER
ut
;
ULARGE_INTEGER
ut
;
FILETIME
ft0
,
ft1
;
FILETIME
ft0
,
ft1
;
long
long
t
;
/* initialize */
int
nsec
;
LDAP_MUTEX_LOCK
(
&
ldap_int_gettime_mutex
);
/* Initialize our offset */
QueryPerformanceFrequency
(
&
_ldap_pvt_gt_freq
);
/* Wait for a tick of the system time: 10-15ms */
/* Wait for a tick of the system time: 10-15ms */
GetSystemTimeAsFileTime
(
&
ft0
);
GetSystemTimeAsFileTime
(
&
ft0
);
do
{
do
{
GetSystemTimeAsFileTime
(
&
ft1
);
GetSystemTimeAsFileTime
(
&
ft1
);
}
while
(
ft1
.
dwLowDateTime
==
ft0
.
dwLowDateTime
);
}
while
(
ft1
.
dwLowDateTime
==
ft0
.
dwLowDateTime
);
QueryPerformanceCounter
(
&
_ldap_pvt_gt_start_count
);
ut
.
LowPart
=
ft1
.
dwLowDateTime
;
ut
.
LowPart
=
ft1
.
dwLowDateTime
;
ut
.
HighPart
=
ft1
.
dwHighDateTime
;
ut
.
HighPart
=
ft1
.
dwHighDateTime
;
QueryPerformanceCounter
(
&
c2
);
_ldap_pvt_gt_start_nsec
=
ut
.
QuadPart
%
TICKS_PER_SECOND
*
100
;
_ldap_pvt_gt_start_sec
=
ut
.
QuadPart
/
TICKS_PER_SECOND
-
SEC_TO_UNIX_EPOCH
;
/* get second and fraction portion of counter */
_ldap_pvt_gt_freq
=
freq
;
t
=
c2
.
QuadPart
%
(
_ldap_pvt_gt_freq
.
QuadPart
*
10
);
_ldap_pvt_gt_nanoticks
=
(
double
)
BILLION
/
freq
.
QuadPart
;
LDAP_MUTEX_UNLOCK
(
&
ldap_int_gettime_mutex
);
/* convert to nanoseconds */
t
*=
BILLION
;
nsec
=
t
/
_ldap_pvt_gt_freq
.
QuadPart
;
ut
.
QuadPart
/=
10
;
ut
.
QuadPart
%=
(
10
*
BILLION
);
_ldap_pvt_gt_offset
=
nsec
-
ut
.
QuadPart
;
count
=
c2
;
}
}
if
(
count
.
QuadPart
<=
_ldap_pvt_gt_prev
.
QuadPart
)
{
QueryPerformanceCounter
(
&
count
);
_ldap_pvt_gt_subs
++
;
count
.
QuadPart
-=
_ldap_pvt_gt_start_count
.
QuadPart
;
}
else
{
*
sec
=
_ldap_pvt_gt_start_sec
+
count
.
QuadPart
/
freq
.
QuadPart
;
_ldap_pvt_gt_subs
=
0
;
nsec
=
_ldap_pvt_gt_start_nsec
+
(
double
)(
count
.
QuadPart
%
freq
.
QuadPart
)
*
_ldap_pvt_gt_nanoticks
;
_ldap_pvt_gt_prev
=
count
;
if
(
nsec
>
BILLION
)
{
nsec
-=
BILLION
;
(
*
sec
)
++
;
}
}
LDAP_MUTEX_UNLOCK
(
&
ldap_int_gettime_mutex
);
return
nsec
;
/* convert to nanoseconds */
count
.
QuadPart
%=
_ldap_pvt_gt_freq
.
QuadPart
*
10
;
count
.
QuadPart
*=
BILLION
;
count
.
QuadPart
/=
_ldap_pvt_gt_freq
.
QuadPart
;
count
.
QuadPart
-=
_ldap_pvt_gt_offset
;
/* We've extracted the 1s and nanoseconds.
* The 1sec digit is used to detect wraparound in nanosecnds.
*/
if
(
count
.
QuadPart
<
0
)
count
.
QuadPart
+=
(
10
*
BILLION
);
else
if
(
count
.
QuadPart
>=
(
10
*
BILLION
))
count
.
QuadPart
-=
(
10
*
BILLION
);
*
sec
=
count
.
QuadPart
/
BILLION
;
return
count
.
QuadPart
%
BILLION
;
}
}
/* emulate POSIX clock_gettime */
/* emulate POSIX clock_gettime */
int
int
ldap_pvt_clock_gettime
(
int
clk_id
,
struct
timespec
*
tv
)
ldap_pvt_clock_gettime
(
int
clk_id
,
struct
timespec
*
tv
)
{
{
FILETIME
ft
;
long
sec
;
ULARGE_INTEGER
ut
;
tv
->
tv_nsec
=
ldap_pvt_gettimensec
(
&
sec
);
int
sec
,
sec0
;
tv
->
tv_sec
=
sec
;
GetSystemTimeAsFileTime
(
&
ft
);
ut
.
LowPart
=
ft
.
dwLowDateTime
;
ut
.
HighPart
=
ft
.
dwHighDateTime
;
/* convert to sec */
ut
.
QuadPart
/=
TICKS_PER_SECOND
;
tv
->
tv_nsec
=
ldap_pvt_gettimensec
(
&
sec
);
tv
->
tv_sec
=
ut
.
QuadPart
-
SEC_TO_UNIX_EPOCH
;
/* check for carry from microseconds */
sec0
=
tv
->
tv_sec
%
10
;
if
(
sec0
<
sec
||
(
sec0
==
9
&&
!
sec
))
tv
->
tv_sec
++
;
return
0
;
return
0
;
}
}
...
@@ -306,6 +255,8 @@ ldap_pvt_gettimeofday( struct timeval *tv, void *unused )
...
@@ -306,6 +255,8 @@ ldap_pvt_gettimeofday( struct timeval *tv, void *unused )
return
0
;
return
0
;
}
}
static
long
_ldap_pvt_gt_prevsec
;
static
int
_ldap_pvt_gt_prevnsec
;
/* return a broken out time, with nanoseconds
/* return a broken out time, with nanoseconds
*/
*/
...
@@ -313,17 +264,18 @@ void
...
@@ -313,17 +264,18 @@ void
ldap_pvt_gettime
(
struct
lutil_tm
*
tm
)
ldap_pvt_gettime
(
struct
lutil_tm
*
tm
)
{
{
SYSTEMTIME
st
;
SYSTEMTIME
st
;
int
sec
,
sec0
;
LARGE_INTEGER
ft
;
static
const
char
daysPerMonth
[]
=
{
long
sec
;
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
GetSystemTime
(
&
st
);
/* Convert sec/nsec to Windows FILETIME,
* then turn that into broken out SYSTEMTIME */
tm
->
tm_nsec
=
ldap_pvt_gettimensec
(
&
sec
);
tm
->
tm_nsec
=
ldap_pvt_gettimensec
(
&
sec
);
tm
->
tm_usub
=
_ldap_pvt_gt_subs
;
ft
.
QuadPart
=
sec
;
ft
.
QuadPart
+=
SEC_TO_UNIX_EPOCH
;
ft
.
QuadPart
*=
TICKS_PER_SECOND
;
ft
.
QuadPart
+=
tm
->
tm_nsec
/
100
;
FileTimeToSystemTime
(
(
FILETIME
*
)
&
ft
,
&
st
);
/* any difference larger than nanoseconds is
* already reflected in st
*/
tm
->
tm_sec
=
st
.
wSecond
;
tm
->
tm_sec
=
st
.
wSecond
;
tm
->
tm_min
=
st
.
wMinute
;
tm
->
tm_min
=
st
.
wMinute
;
tm
->
tm_hour
=
st
.
wHour
;
tm
->
tm_hour
=
st
.
wHour
;
...
@@ -331,42 +283,18 @@ ldap_pvt_gettime( struct lutil_tm *tm )
...
@@ -331,42 +283,18 @@ ldap_pvt_gettime( struct lutil_tm *tm )
tm
->
tm_mon
=
st
.
wMonth
-
1
;
tm
->
tm_mon
=
st
.
wMonth
-
1
;
tm
->
tm_year
=
st
.
wYear
-
1900
;
tm
->
tm_year
=
st
.
wYear
-
1900
;
/* check for carry from nanoseconds */
LDAP_MUTEX_LOCK
(
&
ldap_int_gettime_mutex
);
sec0
=
tm
->
tm_sec
%
10
;
if
(
tm
->
tm_sec
<
_ldap_pvt_gt_prevsec
if
(
sec0
<
sec
||
(
sec0
==
9
&&
!
sec
))
{
||
(
tm
->
tm_sec
==
_ldap_pvt_gt_prevsec
tm
->
tm_sec
++
;
&&
tm
->
tm_nsec
<=
_ldap_pvt_gt_prevnsec
))
{
/* FIXME: we don't handle leap seconds */
_ldap_pvt_gt_subs
++
;
if
(
tm
->
tm_sec
>
59
)
{
}
else
{
tm
->
tm_sec
=
0
;
_ldap_pvt_gt_subs
=
0
;
tm
->
tm_min
++
;
_ldap_pvt_gt_prevsec
=
sec
;
if
(
tm
->
tm_min
>
59
)
{
_ldap_pvt_gt_prevnsec
=
tm
->
tm_nsec
;
tm
->
tm_min
=
0
;
tm
->
tm_hour
++
;
if
(
tm
->
tm_hour
>
23
)
{
int
days
=
daysPerMonth
[
tm
->
tm_mon
];
tm
->
tm_hour
=
0
;
tm
->
tm_mday
++
;
/* if it's February of a leap year,
* add 1 day to this month
*/
if
(
tm
->
tm_mon
==
1
&&
((
!
(
st
.
wYear
%
4
)
&&
(
st
.
wYear
%
100
))
||
!
(
st
.
wYear
%
400
)))
days
++
;
if
(
tm
->
tm_mday
>
days
)
{
tm
->
tm_mday
=
1
;
tm
->
tm_mon
++
;
if
(
tm
->
tm_mon
>
11
)
{
tm
->
tm_mon
=
0
;
tm
->
tm_year
++
;
}
}
}
}
}
}
}
LDAP_MUTEX_UNLOCK
(
&
ldap_int_gettime_mutex
);
tm
->
tm_usub
=
_ldap_pvt_gt_subs
;
}
}
#else
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment