Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
BIND
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
637
Issues
637
List
Boards
Labels
Service Desk
Milestones
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
BIND
Commits
747abb49
Commit
747abb49
authored
Aug 28, 2009
by
Evan Hunt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2658. [bug] dnssec-settime and dnssec-revoke didn't process
key file paths correctly. [RT #20078]
parent
85eb2c76
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
62 deletions
+113
-62
CHANGES
CHANGES
+3
-0
bin/dnssec/dnssec-revoke.c
bin/dnssec/dnssec-revoke.c
+9
-26
bin/dnssec/dnssec-settime.c
bin/dnssec/dnssec-settime.c
+7
-33
lib/isc/include/isc/file.h
lib/isc/include/isc/file.h
+16
-1
lib/isc/unix/file.c
lib/isc/unix/file.c
+36
-1
lib/isc/win32/file.c
lib/isc/win32/file.c
+42
-1
No files found.
CHANGES
View file @
747abb49
2658. [bug] dnssec-settime and dnssec-revoke didn't process
key file paths correctly. [RT #20078]
2657. [cleanup] Lower "journal file <path> does not exist, creating it"
log level to debug 1. [RT #20058]
...
...
bin/dnssec/dnssec-revoke.c
View file @
747abb49
...
...
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-revoke.c,v 1.
6 2009/07/19 05:26:05
each Exp $ */
/* $Id: dnssec-revoke.c,v 1.
7 2009/08/28 03:13:08
each Exp $ */
/*! \file */
...
...
@@ -27,6 +27,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
...
...
@@ -66,7 +67,7 @@ usage(void) {
int
main
(
int
argc
,
char
**
argv
)
{
isc_result_t
result
;
char
*
filename
=
NULL
,
*
dir
=
NULL
;
char
*
filename
=
NULL
,
*
dir
=
NULL
;
char
newname
[
1024
],
oldname
[
1024
];
char
keystr
[
KEY_FORMATSIZE
];
char
*
endp
;
...
...
@@ -126,30 +127,11 @@ main(int argc, char **argv) {
if
(
argc
>
isc_commandline_index
+
1
)
fatal
(
"Extraneous arguments"
);
if
(
dir
==
NULL
)
{
char
*
slash
;
#ifdef _WIN32
char
*
backslash
;
#endif
dir
=
strdup
(
argv
[
isc_commandline_index
]);
filename
=
dir
;
/* Figure out the directory name from the key name */
slash
=
strrchr
(
dir
,
'/'
);
#ifdef _WIN32
backslash
=
strrchr
(
dir
,
'\\'
);
if
((
slash
!=
NULL
&&
backslash
!=
NULL
&&
backslash
>
slash
)
||
(
slash
==
NULL
&&
backslash
!=
NULL
))
slash
=
backslash
;
#endif
if
(
slash
!=
NULL
)
{
*
slash
++
=
'\0'
;
filename
=
slash
;
}
else
{
free
(
dir
);
dir
=
strdup
(
"."
);
}
if
(
dir
!=
NULL
)
{
filename
=
argv
[
isc_commandline_index
];
}
else
{
isc_file_splitpath
(
mctx
,
argv
[
isc_commandline_index
],
&
dir
,
&
filename
);
}
if
(
ectx
==
NULL
)
...
...
@@ -232,6 +214,7 @@ cleanup:
cleanup_entropy
(
&
ectx
);
if
(
verbose
>
10
)
isc_mem_stats
(
mctx
,
stdout
);
isc_mem_free
(
mctx
,
dir
);
isc_mem_destroy
(
&
mctx
);
return
(
0
);
...
...
bin/dnssec/dnssec-settime.c
View file @
747abb49
...
...
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-settime.c,v 1.
6 2009/07/21 02:57:39 jinmei
Exp $ */
/* $Id: dnssec-settime.c,v 1.
7 2009/08/28 03:13:08 each
Exp $ */
/*! \file */
...
...
@@ -29,6 +29,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
...
...
@@ -188,39 +189,12 @@ main(int argc, char **argv) {
if
(
argc
>
isc_commandline_index
+
1
)
fatal
(
"Extraneous arguments"
);
if
(
directory
==
NULL
)
{
char
*
slash
;
#ifdef _WIN32
char
*
backslash
;
#endif
directory
=
isc_mem_strdup
(
mctx
,
argv
[
isc_commandline_index
]);
if
(
directory
==
NULL
)
fatal
(
"Failed to memory allocation for directory"
);
filename
=
directory
;
/* Figure out the directory name from the key name */
slash
=
strrchr
(
directory
,
'/'
);
#ifdef _WIN32
backslash
=
strrchr
(
directory
,
'\\'
);
if
((
slash
!=
NULL
&&
backslash
!=
NULL
&&
backslash
>
slash
)
||
(
slash
==
NULL
&&
backslash
!=
NULL
))
slash
=
backslash
;
#endif
if
(
slash
!=
NULL
)
{
*
slash
++
=
'\0'
;
filename
=
slash
;
}
else
{
isc_mem_free
(
mctx
,
directory
);
/* strdup could be skipped (see above) */
directory
=
isc_mem_strdup
(
mctx
,
"."
);
if
(
directory
==
NULL
)
{
fatal
(
"Failed to memory allocation "
"for directory"
);
}
}
}
else
if
(
directory
!=
NULL
)
{
filename
=
argv
[
isc_commandline_index
];
}
else
{
isc_file_splitpath
(
mctx
,
argv
[
isc_commandline_index
],
&
directory
,
&
filename
);
}
if
(
ectx
==
NULL
)
setup_entropy
(
mctx
,
NULL
,
&
ectx
);
...
...
lib/isc/include/isc/file.h
View file @
747abb49
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: file.h,v 1.3
6 2009/06/10 00:27:22
each Exp $ */
/* $Id: file.h,v 1.3
7 2009/08/28 03:13:08
each Exp $ */
#ifndef ISC_FILE_H
#define ISC_FILE_H 1
...
...
@@ -259,6 +259,21 @@ isc_file_safecreate(const char *filename, FILE **fp);
* that only the owner can read/write it.
*/
isc_result_t
isc_file_splitpath
(
isc_mem_t
*
mctx
,
char
*
path
,
char
**
dirname
,
char
**
basename
);
/*%<
* Split a path into dirname and basename. If 'path' contains no slash
* (or, on windows, backslash), then '*dirname' is set to ".".
*
* Allocates memory for '*dirname', which can be freed with isc_mem_free().
*
* Returns:
* - ISC_R_SUCCESS on success
* - ISC_R_INVALIDFILE if 'path' is empty or ends with '/'
* - ISC_R_NOMEMORY if unable to allocate memory
*/
ISC_LANG_ENDDECLS
#endif
/* ISC_FILE_H */
lib/isc/unix/file.c
View file @
747abb49
...
...
@@ -48,7 +48,7 @@
* SUCH DAMAGE.
*/
/* $Id: file.c,v 1.5
4 2009/06/10 00:27:22
each Exp $ */
/* $Id: file.c,v 1.5
5 2009/08/28 03:13:08
each Exp $ */
/*! \file */
...
...
@@ -68,6 +68,7 @@
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/random.h>
#include <isc/string.h>
#include <isc/time.h>
...
...
@@ -478,3 +479,37 @@ isc_file_safecreate(const char *filename, FILE **fp) {
*
fp
=
f
;
return
(
ISC_R_SUCCESS
);
}
isc_result_t
isc_file_splitpath
(
isc_mem_t
*
mctx
,
char
*
path
,
char
**
dirname
,
char
**
basename
)
{
char
*
dir
,
*
file
,
*
slash
;
slash
=
strrchr
(
path
,
'/'
);
if
(
slash
==
path
)
{
file
=
++
slash
;
dir
=
isc_mem_strdup
(
mctx
,
"/"
);
}
else
if
(
slash
!=
NULL
)
{
file
=
++
slash
;
dir
=
isc_mem_allocate
(
mctx
,
slash
-
path
);
if
(
dir
!=
NULL
)
strlcpy
(
dir
,
path
,
slash
-
path
);
}
else
{
file
=
path
;
dir
=
isc_mem_strdup
(
mctx
,
"."
);
}
if
(
dir
==
NULL
)
return
(
ISC_R_NOMEMORY
);
if
(
*
file
==
'\0'
)
{
isc_mem_free
(
mctx
,
dir
);
return
(
ISC_R_INVALIDFILE
);
}
*
dirname
=
dir
;
*
basename
=
file
;
return
(
ISC_R_SUCCESS
);
}
lib/isc/win32/file.c
View file @
747abb49
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: file.c,v 1.3
3 2009/06/11 23:47:55 tbox
Exp $ */
/* $Id: file.c,v 1.3
4 2009/08/28 03:13:08 each
Exp $ */
#include <config.h>
...
...
@@ -31,6 +31,7 @@
#include <sys/utime.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/time.h>
#include <isc/util.h>
...
...
@@ -541,3 +542,43 @@ isc_file_safecreate(const char *filename, FILE **fp) {
*
fp
=
f
;
return
(
ISC_R_SUCCESS
);
}
isc_result_t
isc_file_splitpath
(
isc_mem_t
*
mctx
,
char
*
path
,
char
**
dirname
,
char
**
basename
)
{
char
*
dir
,
*
file
,
*
slash
;
char
*
backslash
;
slash
=
strrchr
(
path
,
'/'
);
backslash
=
strrchr
(
path
,
'\\'
);
if
((
slash
!=
NULL
&&
backslash
!=
NULL
&&
backslash
>
slash
)
||
(
slash
==
NULL
&&
backslash
!=
NULL
))
slash
=
backslash
;
if
(
slash
==
path
)
{
file
=
++
slash
;
dir
=
isc_mem_strdup
(
mctx
,
"/"
);
}
else
if
(
slash
!=
NULL
)
{
file
=
++
slash
;
dir
=
isc_mem_allocate
(
mctx
,
slash
-
path
);
if
(
dir
!=
NULL
)
strlcpy
(
dir
,
path
,
slash
-
path
);
}
else
{
file
=
path
;
dir
=
isc_mem_strdup
(
mctx
,
"."
);
}
if
(
dir
==
NULL
)
return
(
ISC_R_NOMEMORY
);
if
(
*
file
==
'\0'
)
{
isc_mem_free
(
mctx
,
dir
);
return
(
ISC_R_INVALIDFILE
);
}
*
dirname
=
dir
;
*
basename
=
file
;
return
(
ISC_R_SUCCESS
);
}
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