Merge branch 'master' into storageareas
This commit is contained in:
commit
a41e8a8834
|
@ -245,3 +245,18 @@ User *zmLoadAuthUser( const char *auth, bool use_remote_addr ) {
|
|||
Debug(1, "No user found for auth_key %s", auth );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Function to check Username length
|
||||
bool checkUser ( const char *username) {
|
||||
if ( strlen(username) > 32) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//Function to check password length
|
||||
bool checkPass (const char *password) {
|
||||
if ( strlen(password) > 64) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -77,5 +77,7 @@ public:
|
|||
|
||||
User *zmLoadUser( const char *username, const char *password=0 );
|
||||
User *zmLoadAuthUser( const char *auth, bool use_remote_addr );
|
||||
bool checkUser ( const char *username);
|
||||
bool checkPass (const char *password);
|
||||
|
||||
#endif // ZM_USER_H
|
||||
|
|
|
@ -191,9 +191,12 @@ int main( int argc, const char *argv[] ) {
|
|||
User *user = 0;
|
||||
|
||||
if ( strcmp(config.auth_relay, "none") == 0 ) {
|
||||
if ( username.length() ) {
|
||||
if ( checkUser(username.c_str()) ) {
|
||||
user = zmLoadUser(username.c_str());
|
||||
} else {
|
||||
Error("")
|
||||
}
|
||||
|
||||
} else {
|
||||
//if ( strcmp( config.auth_relay, "hashed" ) == 0 )
|
||||
{
|
||||
|
|
13
src/zmu.cpp
13
src/zmu.cpp
|
@ -425,6 +425,10 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if ( config.opt_use_auth ) {
|
||||
if ( strcmp(config.auth_relay, "none") == 0 ) {
|
||||
if ( !checkUser(username)) {
|
||||
fprintf(stderr, "Error, username greater than allowed 32 characters\n");
|
||||
exit_zmu(-1);
|
||||
}
|
||||
if ( !username ) {
|
||||
fprintf(stderr, "Error, username must be supplied\n");
|
||||
exit_zmu(-1);
|
||||
|
@ -438,7 +442,14 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(stderr, "Error, username and password or auth string must be supplied\n");
|
||||
exit_zmu(-1);
|
||||
}
|
||||
|
||||
if ( !checkUser(username)) {
|
||||
fprintf(stderr, "Error, username greater than allowed 32 characters\n");
|
||||
exit_zmu(-1);
|
||||
}
|
||||
if ( !checkPass(password)) {
|
||||
fprintf(stderr, "Error, password greater than allowed 64 characters\n");
|
||||
exit_zmu(-1);
|
||||
}
|
||||
//if ( strcmp( config.auth_relay, "hashed" ) == 0 )
|
||||
{
|
||||
if ( auth ) {
|
||||
|
|
|
@ -270,7 +270,7 @@ function controlPresets( $monitor, $cmds ) {
|
|||
<?php
|
||||
for ( $i = 1; $i <= $monitor->NumPresets(); $i++ ) {
|
||||
?>
|
||||
<input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?$labels[$i]:"" ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/>
|
||||
<input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?htmlentities($labels[$i]):'' ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/>
|
||||
<?php
|
||||
if ( $i && (($i%$presetBreak) == 0) ) {
|
||||
?><br/><?php
|
||||
|
|
Loading…
Reference in New Issue