mirror of
https://github.com/TurboGit/hubicfuse.git
synced 2026-08-02 02:42:00 +02:00
Get rid of unused options.
This commit is contained in:
+2
-15
@@ -50,15 +50,6 @@ static unsigned long thread_id()
|
||||
}
|
||||
#endif
|
||||
|
||||
static void rewrite_url_snet(char *url)
|
||||
{
|
||||
char protocol[MAX_URL_SIZE];
|
||||
char rest[MAX_URL_SIZE];
|
||||
sscanf(url, "%[a-z]://%s", protocol, rest);
|
||||
if (strncasecmp(rest, "snet-", 5))
|
||||
sprintf(url, "%s://snet-%s", protocol, rest);
|
||||
}
|
||||
|
||||
static size_t xml_dispatch(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
xmlParseChunk((xmlParserCtxtPtr)stream, (char *)ptr, size * nmemb, 0);
|
||||
@@ -452,17 +443,13 @@ void cloudfs_verify_ssl(int vrfy)
|
||||
}
|
||||
|
||||
static struct {
|
||||
char username[MAX_HEADER_SIZE], password[MAX_HEADER_SIZE],
|
||||
tenant[MAX_HEADER_SIZE], authurl[MAX_URL_SIZE], use_snet, ovh;
|
||||
char username[MAX_HEADER_SIZE], password[MAX_HEADER_SIZE];
|
||||
} reconnect_args;
|
||||
|
||||
void cloudfs_set_credentials(char *username, char *tenant, char *password, char *authurl, int use_snet)
|
||||
void cloudfs_set_credentials(char *username, char *password)
|
||||
{
|
||||
strncpy(reconnect_args.username, username, sizeof(reconnect_args.username));
|
||||
strncpy(reconnect_args.tenant, tenant, sizeof(reconnect_args.tenant));
|
||||
strncpy(reconnect_args.password, password, sizeof(reconnect_args.password));
|
||||
strncpy(reconnect_args.authurl, authurl, sizeof(reconnect_args.authurl));
|
||||
reconnect_args.use_snet = use_snet;
|
||||
}
|
||||
|
||||
struct htmlString {
|
||||
|
||||
+1
-2
@@ -24,8 +24,7 @@ typedef struct dir_entry
|
||||
} dir_entry;
|
||||
|
||||
void cloudfs_init();
|
||||
void cloudfs_set_credentials(char *username, char *tenant, char *password,
|
||||
char *authurl, int snet_rewrite);
|
||||
void cloudfs_set_credentials(char *username, char *password);
|
||||
int cloufds_connect();
|
||||
int cloudfs_object_read_fp(const char *path, FILE *fp);
|
||||
int cloudfs_object_write_fp(const char *path, FILE *fp);
|
||||
|
||||
+7
-22
@@ -426,31 +426,21 @@ char *get_home_dir()
|
||||
|
||||
static struct options {
|
||||
char username[OPTION_SIZE];
|
||||
char tenant[OPTION_SIZE];
|
||||
char api_key[OPTION_SIZE];
|
||||
char password[OPTION_SIZE];
|
||||
char cache_timeout[OPTION_SIZE];
|
||||
char authurl[OPTION_SIZE];
|
||||
char use_snet[OPTION_SIZE];
|
||||
char verify_ssl[OPTION_SIZE];
|
||||
} options = {
|
||||
.username = "",
|
||||
.api_key = "",
|
||||
.tenant = "",
|
||||
.password = "",
|
||||
.cache_timeout = "600",
|
||||
.authurl = "https://auth.api.rackspacecloud.com/v1.0",
|
||||
.use_snet = "false",
|
||||
.verify_ssl = "true",
|
||||
};
|
||||
|
||||
int parse_option(void *data, const char *arg, int key, struct fuse_args *outargs)
|
||||
{
|
||||
if (sscanf(arg, " username = %[^\r\n ]", options.username) ||
|
||||
sscanf(arg, " tenant = %[^\r\n ]", options.tenant) ||
|
||||
sscanf(arg, " api_key = %[^\r\n ]", options.api_key) ||
|
||||
sscanf(arg, " password = %[^\r\n ]", options.api_key) ||
|
||||
sscanf(arg, " password = %[^\r\n ]", options.password) ||
|
||||
sscanf(arg, " cache_timeout = %[^\r\n ]", options.cache_timeout) ||
|
||||
sscanf(arg, " authurl = %[^\r\n ]", options.authurl) ||
|
||||
sscanf(arg, " use_snet = %[^\r\n ]", options.use_snet) ||
|
||||
sscanf(arg, " verify_ssl = %[^\r\n ]", options.verify_ssl))
|
||||
return 0;
|
||||
if (!strcmp(arg, "-f") || !strcmp(arg, "-d") || !strcmp(arg, "debug"))
|
||||
@@ -477,18 +467,14 @@ int main(int argc, char **argv)
|
||||
|
||||
cache_timeout = atoi(options.cache_timeout);
|
||||
|
||||
if (!*options.username || !*options.api_key)
|
||||
if (!*options.username || !*options.password)
|
||||
{
|
||||
fprintf(stderr, "Unable to determine username and API key.\n\n");
|
||||
fprintf(stderr, "Unable to determine username and password.\n\n");
|
||||
fprintf(stderr, "These can be set either as mount options or in"
|
||||
"a file named %s\n\n", settings_filename);
|
||||
fprintf(stderr, " username=[Account username]\n");
|
||||
fprintf(stderr, " api_key=[API key (or password for Keystone API)]\n\n");
|
||||
fprintf(stderr, " password=[Account password]\n");
|
||||
fprintf(stderr, "The following settings are optional:\n\n");
|
||||
fprintf(stderr, " authurl=[Authentication url - connect to non-Rackspace Swift]\n");
|
||||
fprintf(stderr, " tenant=[Tenant for authentication with Keystone, enables Auth 2.0 API]\n");
|
||||
fprintf(stderr, " password=[Alias for api_key, if using Keystone API]\n");
|
||||
fprintf(stderr, " use_snet=[True to use Rackspace ServiceNet for connections]\n");
|
||||
fprintf(stderr, " cache_timeout=[Seconds for directory caching, default 600]\n");
|
||||
fprintf(stderr, " verify_ssl=[False to disable SSL cert verification]\n");
|
||||
|
||||
@@ -499,8 +485,7 @@ int main(int argc, char **argv)
|
||||
|
||||
cloudfs_verify_ssl(!strcasecmp(options.verify_ssl, "true"));
|
||||
|
||||
cloudfs_set_credentials(options.username, options.tenant, options.api_key,
|
||||
options.authurl, !strcasecmp(options.use_snet, "true"));
|
||||
cloudfs_set_credentials(options.username, options.password);
|
||||
if (!cloudfs_connect())
|
||||
{
|
||||
fprintf(stderr, "Failed to authenticate.\n");
|
||||
|
||||
Reference in New Issue
Block a user