GNURLOPT_SSH_KEYDATA(3)
β¨ GNURLOPT_SSH_KEYDATA(3) β¨
okay so this is a page from the curl_easy_setopt options manual, bestie β yes that curl, the one your whole internet runs on β and today's topic is a lil' pointer that just... rides along. π
π NAME π
CURLOPT_SSH_KEYDATA β the pointer you hand off to the SSH key callback, no questions asked, no cap π«Ά
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KEYDATA, void
*pointer);
π¦ DESCRIPTION π¦
so you pass a void * as the parameter. mmm yes pointer, iconic behavior. π
and then? that pointer gets passed along verbatim to the callback you set with CURLOPT_SSH_KEYFUNCTION(3). verbatim verbatim. like, it doesn't get touched, it doesn't get copied, it doesn't get judged β it just shows up at the callback like "hi i'm here π". lowkey the most loyal option in the whole set ngl β¨
π§ DEFAULT π§
NULL
(empty. blank. no pointer. it's giving "nothing to see here" π)
π PROTOCOLS π
SFTP and SCP β ssh vibes only bestie π
π EXAMPLE π
ok so here's the whole moment, look at it:
static int keycb(CURL *easy,
const struct curl_khkey *knownkey,
const struct curl_khkey *foundkey,
enum curl_khmatch,
void *clientp)
{
/* 'clientp' points to the callback_data struct */
/* investigate the situation and return the correct value */
return CURLKHSTAT_FINE_ADD_TO_FILE;
}
{
curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
curl_easy_setopt(curl, CURLOPT_SSH_KEYFUNCTION, keycb);
curl_easy_setopt(curl, CURLOPT_SSH_KEYDATA, &callback_data);
curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS, "/home/user/known_hosts");
curl_easy_perform(curl);
}
see how &callback_data goes in as the keydata and then comes out the other side as clientp? yeah. that's the whole bit. the way that pointer just travels ππ«Ά
β AVAILABILITY β
added in 7.19.6 β retro, vintage, a classic π
π₯ RETURN VALUE π₯
returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. like, either we slay or we don't, there is no third option. π
π SEE ALSO π
ok tiny heads up bestie β yeah that's the option itself listed in its own SEE ALSO, that's just what the page says, i don't make the rules π
and that's the page!! πβ¨
this whole thing is from libcurl 7.37.0, dated 19 Jun 2014 β so if you're reading this in a group chat sometime later, know the lore is old but the vibes are forever π π¦β
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms