Esempio n. 1
0
JNIEXPORT jboolean JNICALL
Java_com_sun_netstorage_samqfs_mgmt_arc_Archiver_isValidUser(JNIEnv *env,
	jclass cls /*ARGSUSED*/, jobject ctx, jstring usrName) {

	jboolean isCopy;
	int res;
	boolean_t isValid;
	char *cstr = GET_STR(usrName, isCopy);

	PTRACE(1, "jni:Archiver_isValidUser");
	res = is_valid_user(CTX, cstr, &isValid);
	REL_STR(usrName, cstr, isCopy);
	if (-1 == res) {
		ThrowEx(env);
		return (NULL);
	}
	PTRACE(1, "jni:done checking user");
	return (JBOOL(isValid));
}
Esempio n. 2
0
int main()
{
    char username[256];
    char password[256];

    printf("username> ");
    scanf("%s", username);
    printf("password> ");
    scanf("%s", password);

    if(is_valid_user(username, password))
    {
        printf("Welcome, %s!\n", username);
    }
    else
    {
        printf("Login rejected!\n");
    }
	return 0;
}