/* send a password question */ if (vio->write_packet(vio, (constunsignedchar *) PASSWORD_QUESTION, 1)) return CR_ERROR;
/* read the answer */ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) return CR_ERROR;
info->password_used= PASSWORD_USED_YES;
/* fail if the password is wrong */ if (strcmp((constchar *) pkt, info->auth_string)) return CR_ERROR;
/* Check the contens of components of info */ if (strcmp(info->user_name, "qa_test_1_user")== 0)
{ if (info->user_name_length != 14)
err= CR_ERROR; if (strcmp(info->auth_string, "qa_test_1_dest"))
err= CR_ERROR; if (info->auth_string_length != 14)
err= CR_ERROR; /* To be set by the plugin */ /* if (strcmp(info->authenticated_as, "qa_test_1_user")) */ /* err= CR_ERROR; */ /* To be set by the plugin */ /* if (strcmp(info->external_user, "")) */ /* err= CR_ERROR; */ if (info->password_used != PASSWORD_USED_YES)
err= CR_ERROR; if (strcmp(info->host_or_ip, "localhost"))
err= CR_ERROR; if (info->host_or_ip_length != 9)
err= CR_ERROR;
} /* Assign values to the components of info even if not intended and watch the effect */ elseif (strcmp(info->user_name, "qa_test_2_user")== 0)
{ /* Overwriting not intended, but with effect on USER() */
strcpy((char*) info->user_name, "user_name");
info->user_name_length= 9; /* Overwriting not intended, effect not visible */
strcpy((char *)info->auth_string, "auth_string");
info->auth_string_length= 11; /* Assign with account for authorization, effect on CURRENT_USER() */
strcpy(info->authenticated_as, "authenticated_as"); /* Assign with an external account, effect on @@local.EXTERNAL_USER */
strcpy(info->external_user, "externaluser"); /* Overwriting will cause a core dump */ /* strcpy(info->host_or_ip, "host_or_ip"); */ /* info->host_or_ip_length= 10; */
} /* Invalid, means too high values for length */ elseif (strcmp(info->user_name, "qa_test_3_user")== 0)
{ /* Original value is 14. Test runs also with higher value. Changes have no effect.*/
info->user_name_length= 28;
strcpy((char *)info->auth_string, "qa_test_3_dest"); /* Original value is 14. Test runs also with higher value. Changes have no effect.*/
info->auth_string_length= 28;
strcpy(info->authenticated_as, info->auth_string);
strcpy(info->external_user, info->auth_string);
} /* Invalid, means too low values for length */ elseif (strcmp(info->user_name, "qa_test_4_user")== 0)
{ /* Original value is 14. Test runs also with lower value. Changes have no effect.*/
info->user_name_length= 8;
strcpy((char *)info->auth_string, "qa_test_4_dest"); /* Original value is 14. Test runs also with lower value. Changes have no effect.*/
info->auth_string_length= 8;
strcpy(info->authenticated_as, info->auth_string);
strcpy(info->external_user, info->auth_string);
} /* Overwrite with empty values */ elseif (strcmp(info->user_name, "qa_test_5_user")== 0)
{ /* This assignment has no effect.*/
strcpy((char*) info->user_name, "");
info->user_name_length= 0; /* This assignment has no effect.*/
strcpy((char *)info->auth_string, "");
info->auth_string_length= 0; /* This assignment caused an error or an "empty" user */
strcpy(info->authenticated_as, ""); /* This assignment has no effect.*/
strcpy(info->external_user, ""); /* Overwriting will cause a core dump */ /* strcpy(info->host_or_ip, ""); */ /* info->host_or_ip_length= 0; */
} /* Set to 'root' */ elseif (strcmp(info->user_name, "qa_test_6_user")== 0)
{
strcpy(info->authenticated_as, "root");
} else
{
err= CR_ERROR;
} return err;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.