}
sprintf(lrdd_template, "%s://%s/.well-known/webfinger?resource={uri}",
RS_SCHEME, RS_HOSTNAME);
- storage_uri_format_len = strlen(RS_SCHEME) + strlen(RS_HOSTNAME) + 12;
+ storage_uri_format_len = strlen(RS_SCHEME) + strlen(RS_HOSTNAME) + 13;
storage_uri_format = malloc(storage_uri_format_len + 2 + 1);
- sprintf(storage_uri_format, "%s://%s/storage/%%s", RS_SCHEME, RS_HOSTNAME);
+ sprintf(storage_uri_format, "%s://%s/storage/%%s/%%s", RS_SCHEME, RS_HOSTNAME);
}
static size_t json_writer(char *buf, size_t count, void *arg) {
return evbuffer_add((struct evbuffer*)arg, buf, count);
}
+#if 0
static int process_resource(const char *resource, char **storage_uri, char **auth_uri) {
+#else
+static int process_resource(const char *resource, char **storage_uri) {
+#endif
size_t resource_len = strlen(resource);
char *resource_buf = malloc(resource_len + 1);
log_debug("hostname: %s", hostname);
// check hostname
if(strcmp(hostname, RS_HOSTNAME) == 0) {
+#if 0
uid_t uid = user_get_uid(local_part);
log_debug("got uid: %d (RS_MIN_UID: %d, allowed: %d)", uid,
RS_MIN_UID, UID_ALLOWED(uid));
// check if user is valid
if(UID_ALLOWED(uid)) {
- *storage_uri = malloc(storage_uri_format_len + strlen(local_part) + 1);
- sprintf(*storage_uri, storage_uri_format, local_part);
+#endif
+ *storage_uri = malloc(storage_uri_format_len + strlen(hostname) + strlen(local_part) + 1);
+ sprintf(*storage_uri, storage_uri_format, hostname, local_part);
+#if 0
*auth_uri = malloc(RS_AUTH_URI_LEN + strlen(local_part) + 1);
sprintf(*auth_uri, RS_AUTH_URI, local_part);
+#endif
free(resource_buf);
return 0; // success!
+#if 0
}
+#endif
}
}
const char *resource;
if(req->uri->query && (resource = evhtp_kv_find(req->uri->query, "resource"))) {
+#if 0
char *storage_uri = NULL, *auth_uri = NULL;
+#else
+ char *storage_uri = NULL;
+#endif
+#if 0
if(process_resource(resource, &storage_uri, &auth_uri) != 0) {
+#else
+ if(process_resource(resource, &storage_uri) != 0) {
+#endif
req->status = EVHTP_RES_NOTFOUND;
} else {
json_write_key_val(json, "subject", resource);
free(storage_uri);
json_write_key(json, "properties");
json_start_object(json);
+#if 0
json_write_key_val(json, RS_AUTH_METHOD, auth_uri);
// (begin legacy support [<= remotestorage-00])
json_write_key_val(json, "auth-method", RS_AUTH_METHOD);
json_write_key_val(json, "auth-endpoint", auth_uri);
// (end legacy support)
free(auth_uri);
+#endif
json_end_object(json); // properties
json_end_object(json); // link rel=remotestorage]
json_end_array(json); // links