Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
8d49d1cd
Commit
8d49d1cd
authored
Dec 30, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vlc_credential API
parent
868b8453
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
469 additions
and
2 deletions
+469
-2
include/vlc_keystore.h
include/vlc_keystore.h
+102
-1
src/libvlccore.sym
src/libvlccore.sym
+4
-0
src/misc/keystore.c
src/misc/keystore.c
+363
-1
No files found.
include/vlc_keystore.h
View file @
8d49d1cd
...
...
@@ -30,9 +30,10 @@
typedef
struct
vlc_keystore
vlc_keystore
;
typedef
struct
vlc_keystore_entry
vlc_keystore_entry
;
typedef
struct
vlc_credential
vlc_credential
;
/**
* @defgroup keystore Keystore API
* @defgroup keystore Keystore
and credential
API
* @{
* @defgroup keystore_public Keystore public API
* @{
...
...
@@ -144,6 +145,106 @@ vlc_keystore_remove(vlc_keystore *p_keystore,
VLC_API
void
vlc_keystore_release_entries
(
vlc_keystore_entry
*
p_entries
,
unsigned
int
i_count
);
/**
* @}
* @defgroup credential Credential API
* @{
*/
/**
* @note init with vlc_credential_init()
*/
struct
vlc_credential
{
/** url to store or to search */
const
vlc_url_t
*
p_url
;
/** http realm or smb domain */
const
char
*
psz_realm
;
/** http authtype */
const
char
*
psz_authtype
;
/** valid only if vlc_credential_get() returned true */
const
char
*
psz_username
;
/** valid only if vlc_credential_get() returned true */
const
char
*
psz_password
;
/* internal */
enum
{
GET_FROM_URL
,
GET_FROM_OPTION
,
GET_FROM_KEYSTORE
,
GET_FROM_DIALOG
,
}
i_get_order
;
vlc_keystore
*
p_keystore
;
vlc_keystore_entry
*
p_entries
;
unsigned
int
i_entries_count
;
char
*
psz_split_realm
;
char
*
psz_var_username
;
char
*
psz_var_password
;
char
*
psz_dialog_username
;
char
*
psz_dialog_password
;
bool
b_store
;
};
/**
* Init a credential struct
*
* @note to be cleaned with vlc_credential_clean()
*
* @param psz_url url to store or to search
*/
VLC_API
void
vlc_credential_init
(
vlc_credential
*
p_credential
,
const
vlc_url_t
*
p_url
);
/**
* Clean a credential struct
*/
VLC_API
void
vlc_credential_clean
(
vlc_credential
*
p_credential
);
/**
* Get a username/password couple
*
* This will search for a credential using url, VLC options, the vlc_keystore
* or by asking the user via dialog_Login(). This function can be called
* indefinitely, it will first return the user/password from the url (if any),
* then from VLC options (if any), then from the keystore (if any), and finally
* from the dialog (if any). This function will return true as long as the user
* fill the dialog texts and will return false when the user cancel it.
*
* @param p_parent the parent object (for var, keystore and dialog)
* @param psz_option_username VLC option name for the username
* @param psz_option_password VLC option name for the password
* @param psz_dialog_title dialog title, if NULL, this function won't use the
* keystore or the dialog
* @param psz_dialog_fmt dialog text using format
*
* @return true if vlc_credential.psz_username and vlc_credential.psz_password
* are valid, otherwise this function should not be called again.
*/
VLC_API
bool
vlc_credential_get
(
vlc_credential
*
p_credential
,
vlc_object_t
*
p_parent
,
const
char
*
psz_option_username
,
const
char
*
psz_option_password
,
const
char
*
psz_dialog_title
,
const
char
*
psz_dialog_fmt
,
...)
VLC_FORMAT
(
6
,
7
);
#define vlc_credential_get(a, b, c, d, e, f, ...) \
vlc_credential_get(a, VLC_OBJECT(b), c, d, e, f, ##__VA_ARGS__)
/**
* Store the last dialog credential returned by vlc_credential_get()
*
* This function will store the credential only if it comes from the dialog and
* if the vlc_keystore object is valid.
*
* @return true if credential was stored, false otherwise
*/
VLC_API
bool
vlc_credential_store
(
vlc_credential
*
p_credential
);
/**
* @}
* @defgroup keystore_implementation Implemented by keystore modules
...
...
src/libvlccore.sym
View file @
8d49d1cd
...
...
@@ -519,6 +519,10 @@ vlc_cond_init_daytime
vlc_cond_signal
vlc_cond_timedwait
vlc_cond_wait
vlc_credential_init
vlc_credential_clean
vlc_credential_get
vlc_credential_store
vlc_sem_init
vlc_sem_destroy
vlc_sem_post
...
...
src/misc/keystore.c
View file @
8d49d1cd
This diff is collapsed.
Click to expand it.
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