Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Barchiesi
OpenLDAP
Commits
30a9b1d7
Commit
30a9b1d7
authored
15 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
ITS#6041
parent
f5527def
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES
+1
-0
1 addition, 0 deletions
CHANGES
include/ac/dirent.h
+3
-0
3 additions, 0 deletions
include/ac/dirent.h
libraries/liblutil/utils.c
+42
-4
42 additions, 4 deletions
libraries/liblutil/utils.c
with
46 additions
and
4 deletions
CHANGES
+
1
−
0
View file @
30a9b1d7
...
...
@@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log
OpenLDAP 2.4.17 Engineering
Fixed libldap gnutls private key init (ITS#6053)
Fixed liblutil opendir/closedir on windows (ITS#6041)
Fixed slapd errno handling (ITS#6037)
Fixed slapd global alloc handling (ITS#6054)
Fixed slapd moduleload with static backends and modules (ITS#6016)
...
...
This diff is collapsed.
Click to expand it.
include/ac/dirent.h
+
3
−
0
View file @
30a9b1d7
...
...
@@ -34,6 +34,9 @@ typedef struct DIR {
int
first
;
char
buf
[
MAX_PATH
+
1
];
}
DIR
;
DIR
*
opendir
(
const
char
*
name
);
struct
dirent
*
readdir
(
DIR
*
dir
);
int
closedir
(
DIR
*
dir
);
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
...
...
This diff is collapsed.
Click to expand it.
libraries/liblutil/utils.c
+
42
−
4
View file @
30a9b1d7
...
...
@@ -466,6 +466,40 @@ int mkstemp( char * template )
#endif
#ifdef _MSC_VER
/* Equivalent of MS CRT's _dosmaperr().
* @param lastError[in] Result of GetLastError().
*/
static
errno_t
win2errno
(
DWORD
lastError
)
{
const
struct
{
DWORD
windows_code
;
errno_t
errno_code
;
}
WIN2ERRNO_TABLE
[]
=
{
{
ERROR_SUCCESS
,
0
},
{
ERROR_FILE_NOT_FOUND
,
ENOENT
},
{
ERROR_PATH_NOT_FOUND
,
ENOENT
},
{
ERROR_TOO_MANY_OPEN_FILES
,
EMFILE
},
{
ERROR_ACCESS_DENIED
,
EACCES
},
{
ERROR_INVALID_HANDLE
,
EBADF
},
{
ERROR_NOT_ENOUGH_MEMORY
,
ENOMEM
},
{
ERROR_LOCK_VIOLATION
,
EACCES
},
{
ERROR_FILE_EXISTS
,
EEXIST
},
{
ERROR_INVALID_PARAMETER
,
EINVAL
},
{
ERROR_FILENAME_EXCED_RANGE
,
ENAMETOOLONG
},
};
const
unsigned
int
WIN2ERRNO_TABLE_SIZE
=
sizeof
(
WIN2ERRNO_TABLE
)
/
sizeof
(
WIN2ERRNO_TABLE
[
0
]);
const
errno_t
DEFAULT_ERRNO_ERROR
=
-
1
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
WIN2ERRNO_TABLE_SIZE
;
++
i
)
{
if
(
WIN2ERRNO_TABLE
[
i
].
windows_code
==
lastError
)
{
return
WIN2ERRNO_TABLE
[
i
].
errno_code
;
}
}
return
DEFAULT_ERRNO_ERROR
;
}
struct
dirent
{
char
*
d_name
;
};
...
...
@@ -483,8 +517,10 @@ DIR *opendir( char *path )
HANDLE
h
;
WIN32_FIND_DATA
data
;
if
(
len
+
3
>=
sizeof
(
tmp
))
if
(
len
+
3
>=
sizeof
(
tmp
))
{
errno
=
ENAMETOOLONG
;
return
NULL
;
}
strcpy
(
tmp
,
path
);
tmp
[
len
++
]
=
'\\'
;
...
...
@@ -492,9 +528,11 @@ DIR *opendir( char *path )
tmp
[
len
]
=
'\0'
;
h
=
FindFirstFile
(
tmp
,
&
data
);
if
(
h
==
INVALID_HANDLE_VALUE
)
if
(
h
==
INVALID_HANDLE_VALUE
)
{
errno
=
win2errno
(
GetLastError
());
return
NULL
;
}
d
=
ber_memalloc
(
sizeof
(
DIR
)
);
if
(
!
d
)
...
...
@@ -518,7 +556,7 @@ struct dirent *readdir(DIR *dir)
}
return
&
dir
->
data
;
}
void
closedir
(
DIR
*
dir
)
int
closedir
(
DIR
*
dir
)
{
FindClose
(
dir
->
dir
);
ber_memfree
(
dir
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment