From: Jon Langseth Date: Wed, 25 Jan 2012 19:04:42 +0000 (+0100) Subject: Made default password lenght a config option. Added permittedcalls-info to doc X-Git-Url: https://git.defcon.no/?p=hermes;a=commitdiff_plain;h=0131a2e9da7f458f4bf7765586620a702165f890 Made default password lenght a config option. Added permittedcalls-info to doc --- diff --git a/api/config.php.sample b/api/config.php.sample index d6cb579..8b64b30 100644 --- a/api/config.php.sample +++ b/api/config.php.sample @@ -28,6 +28,7 @@ function get_config() 'standard_dialplan' => '(*xx*.|xxx.)', 'default_domain' => 'hig.no', 'permit_multiple_e164alias' => false, + 'standard_password_length' => 10, ); } ?> diff --git a/api/lib/user_functions.php b/api/lib/user_functions.php index f1e660b..b15b741 100644 --- a/api/lib/user_functions.php +++ b/api/lib/user_functions.php @@ -5,10 +5,11 @@ require_once('lib/db_functions.php'); $config = get_config(); -// Default length 24 characters to provide a long password -// that still is short enough that Cisco SPA phones can use it -function generate_password( $length = 24 ) +function generate_password( $length = null ) { + global $config; + if ( ! $length ) $length = $config['standard_password_length']; + $string = ""; while ( strlen( $string ) < $length ) { diff --git a/doc/api-nodes.txt b/doc/api-nodes.txt index a9f500e..4215059 100644 --- a/doc/api-nodes.txt +++ b/doc/api-nodes.txt @@ -405,6 +405,7 @@ user/available Return: Returns 'ok' with 'cause' = 'nonexistant' if the address is available. + TODO: Returns 'failed' with 'cause' = 'domain' if the domain is not a kamailio domain. Returns 'failed' with 'cause' = 'exists' if the address is in use. Returns 'failed' with 'cause' = 'invalid' if SIP address is malformed. @@ -707,6 +708,18 @@ TODO list: Some TODO's listed above ... Permissions! (user/permissions?user=...) +The permissions bit-flag seems to be: + NOCALLS 1 + EMERGENCY 2 + INTERNAL 4 + VOIP 8 + NATIONAL 16 + SERVICES 32 + INTERNATIONAL 64 + OTHERS 128 + +can_write() checks! +can_read_full() checks! Improve robustness of change_pw: fetch old password for rollback/testing.