Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
libaacs
Commits
fdef27fb
Commit
fdef27fb
authored
May 01, 2012
by
npzacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved _load_config() to keydbcfg.c
parent
83b6b7b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
41 deletions
+41
-41
src/file/keydbcfg.c
src/file/keydbcfg.c
+37
-3
src/file/keydbcfg.h
src/file/keydbcfg.h
+1
-3
src/libaacs/aacs.c
src/libaacs/aacs.c
+3
-35
No files found.
src/file/keydbcfg.c
View file @
fdef27fb
...
...
@@ -244,7 +244,7 @@ static int _parse_cert_file(config_file *cf, FILE *fp)
return
result
;
}
int
keydbcfg
_load_pk_file
(
config_file
*
cf
)
static
int
_load_pk_file
(
config_file
*
cf
)
{
static
const
char
pk_file_name
[]
=
PK_FILE_NAME
;
FILE
*
fp
;
...
...
@@ -265,7 +265,7 @@ int keydbcfg_load_pk_file(config_file *cf)
return
result
;
}
int
keydbcfg
_load_cert_file
(
config_file
*
cf
)
static
int
_load_cert_file
(
config_file
*
cf
)
{
static
const
char
cert_file_name
[]
=
CERT_FILE_NAME
;
FILE
*
fp
;
...
...
@@ -402,7 +402,7 @@ int keycache_find(const char *type, const uint8_t *disc_id, uint8_t *key, unsign
return
result
;
}
char
*
keydbcfg
_find_config_file
(
void
)
static
char
*
_find_config_file
(
void
)
{
static
const
char
cfg_file_name
[]
=
CFG_FILE_NAME
;
...
...
@@ -422,3 +422,37 @@ char *keydbcfg_find_config_file(void)
return
cfg_file
;
}
config_file
*
keydbcfg_config_load
(
const
char
*
configfile_path
)
{
int
config_ok
=
0
;
config_file
*
cf
=
keydbcfg_new_config_file
();
/* try to load KEYDB.cfg */
if
(
configfile_path
)
{
config_ok
=
keydbcfg_parse_config
(
cf
,
configfile_path
);
}
else
{
/* If no configfile path given, check for config files in user's home or
* under /etc.
*/
char
*
cfgfile
=
_find_config_file
();
config_ok
=
keydbcfg_parse_config
(
cf
,
cfgfile
);
X_FREE
(
cfgfile
);
}
/* Try to load simple (aacskeys) config files */
config_ok
=
_load_pk_file
(
cf
)
||
config_ok
;
config_ok
=
_load_cert_file
(
cf
)
||
config_ok
;
if
(
!
config_ok
)
{
DEBUG
(
DBG_AACS
|
DBG_CRIT
,
"No valid AACS configuration files found
\n
"
);
keydbcfg_config_file_close
(
cf
);
return
NULL
;
}
return
cf
;
}
src/file/keydbcfg.h
View file @
fdef27fb
...
...
@@ -118,9 +118,7 @@ AACS_PRIVATE int keydbcfg_config_file_close(config_file *cfgfile);
/* */
AACS_PRIVATE
char
*
keydbcfg_find_config_file
(
void
);
AACS_PRIVATE
int
keydbcfg_load_cert_file
(
config_file
*
cf
);
AACS_PRIVATE
int
keydbcfg_load_pk_file
(
config_file
*
cf
);
AACS_PRIVATE
config_file
*
keydbcfg_config_load
(
const
char
*
configfile_path
);
AACS_PRIVATE
int
keycache_save
(
const
char
*
type
,
const
uint8_t
*
disc_id
,
const
uint8_t
*
key
,
unsigned
int
len
);
...
...
src/libaacs/aacs.c
View file @
fdef27fb
...
...
@@ -596,39 +596,6 @@ static int _decrypt_unit(AACS *aacs, uint8_t *out_buf, const uint8_t *in_buf, ui
return
0
;
}
static
int
_load_config
(
AACS
*
aacs
,
const
char
*
configfile_path
)
{
int
config_ok
=
0
;
aacs
->
cf
=
keydbcfg_new_config_file
();
/* try to load KEYDB.cfg */
if
(
configfile_path
)
{
config_ok
=
keydbcfg_parse_config
(
aacs
->
cf
,
configfile_path
);
}
else
{
/* If no configfile path given, check for config files in user's home or
* under /etc.
*/
char
*
cfgfile
=
keydbcfg_find_config_file
();
config_ok
=
keydbcfg_parse_config
(
aacs
->
cf
,
cfgfile
);
X_FREE
(
cfgfile
);
}
/* Try to load simple (aacskeys) config files */
config_ok
=
keydbcfg_load_pk_file
(
aacs
->
cf
)
||
config_ok
;
config_ok
=
keydbcfg_load_cert_file
(
aacs
->
cf
)
||
config_ok
;
if
(
!
config_ok
)
{
DEBUG
(
DBG_AACS
|
DBG_CRIT
,
"No valid AACS configuration files found
\n
"
);
return
AACS_ERROR_NO_CONFIG
;
}
return
AACS_SUCCESS
;
}
void
aacs_get_version
(
int
*
major
,
int
*
minor
,
int
*
micro
)
{
*
major
=
AACS_VERSION_MAJOR
;
...
...
@@ -663,9 +630,10 @@ AACS *aacs_open2(const char *path, const char *configfile_path, int *error_code)
AACS
*
aacs
=
calloc
(
1
,
sizeof
(
AACS
));
*
error_code
=
_load_config
(
aacs
,
configfile_path
);
if
(
*
error_code
!=
AACS_SUCCESS
)
{
aacs
->
cf
=
keydbcfg_config_load
(
configfile_path
);
if
(
!
aacs
->
cf
)
{
aacs_close
(
aacs
);
*
error_code
=
AACS_ERROR_NO_CONFIG
;
return
NULL
;
}
...
...
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