int
main(int argc, const char **argv)
{
    git_credential_t cred = {0};

    if (argc < 2) {
	error("Usage: git credential-gnomekeyring <get|store|erase>");
	return 1;
    }

    if (read_credential(&cred)) {
	clear_credential(&cred);
	return 1;
    }

    if (strcmp(argv[1], "get") == 0) {
	get_password(&cred);
    }
    else if (strcmp(argv[1], "store") == 0) {
	store_password(&cred);
    }
    else if (strcmp(argv[1], "erase") == 0) {
	erase_password(&cred);
    }
    clear_credential(&cred);

    return 0;
}
Exemplo n.º 2
0
int
main(int argc, const char **argv)
{
    jaro_credential_t cred = {0};
    int res = 0;

    if (argc < 2) {
	error("Usage: jaro-gnome-keyring <get|check|store|erase>");
	error("input from stdin: newline separated parameter=value tuples");
	error("i.e: protocol, path, username, host, password (password on store)");
	return 1;
    }

    if (read_credential(&cred)) {
	clear_credential(&cred);
	return 1;
    }

    if (strcmp(argv[1], "get") == 0) {
      res = get_password(&cred);
    }
    if (strcmp(argv[1], "check") == 0) {
      res = check_password(&cred);
    }
    else if (strcmp(argv[1], "store") == 0) {
      res = store_password(&cred);
    }
    else if (strcmp(argv[1], "erase") == 0) {
      res = erase_password(&cred);
    }
    clear_credential(&cred);

    return res;
}
Exemplo n.º 3
0
int main(int argc, char *argv[])
{
	const char *usage =
	    "usage: git credential-wincred <get|store|erase>\n";

	if (!argv[1])
		die(usage);

	/* git use binary pipes to avoid CRLF-issues */
	_setmode(_fileno(stdin), _O_BINARY);
	_setmode(_fileno(stdout), _O_BINARY);

	read_credential();

	load_cred_funcs();

	if (!protocol || !(host || path))
		return 0;

	/* prepare 'target', the unique key for the credential */
	wcscpy(target, L"git:");
	wcsncat(target, protocol, ARRAY_SIZE(target));
	wcsncat(target, L"://", ARRAY_SIZE(target));
	if (wusername) {
		wcsncat(target, wusername, ARRAY_SIZE(target));
		wcsncat(target, L"@", ARRAY_SIZE(target));
	}
	if (host)
		wcsncat(target, host, ARRAY_SIZE(target));
	if (path) {
		wcsncat(target, L"/", ARRAY_SIZE(target));
		wcsncat(target, path, ARRAY_SIZE(target));
	}

	if (!strcmp(argv[1], "get"))
		get_credential();
	else if (!strcmp(argv[1], "store"))
		store_credential();
	else if (!strcmp(argv[1], "erase"))
		erase_credential();
	/* otherwise, ignore unknown action */
	return 0;
}
Exemplo n.º 4
0
int main(int argc, const char **argv)
{
	const char *usage =
		"Usage: git credential-osxkeychain <get|store|erase>";

	if (!argv[1])
		die(usage);

	read_credential();

	if (!strcmp(argv[1], "get"))
		find_internet_password();
	else if (!strcmp(argv[1], "store"))
		add_internet_password();
	else if (!strcmp(argv[1], "erase"))
		delete_internet_password();
	/* otherwise, ignore unknown action */

	return 0;
}