aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/git-lfs-authenticate/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/git-lfs-authenticate/main.c')
-rw-r--r--cmd/git-lfs-authenticate/main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/cmd/git-lfs-authenticate/main.c b/cmd/git-lfs-authenticate/main.c
index 0f45e49..71481e9 100644
--- a/cmd/git-lfs-authenticate/main.c
+++ b/cmd/git-lfs-authenticate/main.c
@@ -62,15 +62,15 @@ void printescjson(const char *str) {
62void checkrepopath(const char *path) { 62void checkrepopath(const char *path) {
63 if (strstr(path, "//") || strstr(path, "/./") || strstr(path, "/../") 63 if (strstr(path, "//") || strstr(path, "/./") || strstr(path, "/../")
64 || hasprefix(path, "./") || hasprefix(path, "../") || hasprefix(path, "/../")) 64 || hasprefix(path, "./") || hasprefix(path, "../") || hasprefix(path, "/../"))
65 die("Bad repository name: is unresolved path"); 65 die("Bad repository name: Is unresolved path");
66 if (strlen(path) > 100) 66 if (strlen(path) > 100)
67 die("Bad repository name: longer than 100 characters"); 67 die("Bad repository name: Longer than 100 characters");
68 if (hassuffix(path, "/")) 68 if (hassuffix(path, "/"))
69 die("Bad repositry name: unexpected trailing slash"); 69 die("Bad repositry name: Unexpected trailing slash");
70 if (hasprefix(path, "/")) 70 if (hasprefix(path, "/"))
71 die("Bad repository name: unexpected absolute path"); 71 die("Bad repository name: Unexpected absolute path");
72 if (!hassuffix(path, ".git")) 72 if (!hassuffix(path, ".git"))
73 die("Bad repository name: expected '.git' repo path suffix"); 73 die("Bad repository name: Expected '.git' repo path suffix");
74 74
75 struct stat statbuf; 75 struct stat statbuf;
76 if (stat(path, &statbuf)) { 76 if (stat(path, &statbuf)) {
@@ -203,8 +203,8 @@ void makehextag(const taginfo_t info, uint8_t key[KEYSIZE], char dest[MAX_HEXTAG
203 memset(dest, 0, MAX_HEXTAG_STRLEN + 1); 203 memset(dest, 0, MAX_HEXTAG_STRLEN + 1);
204 for (size_t i = 0; i < rawtag_len; i++) { 204 for (size_t i = 0; i < rawtag_len; i++) {
205 uint8_t b = rawtag[i]; 205 uint8_t b = rawtag[i];
206 dest[i] = (b >> 4) + ((b >> 4) < 10 ? '0' : 'a'); 206 dest[i * 2] = (b >> 4) + ((b >> 4) < 10 ? '0' : 'a');
207 dest[i + 1] = (b & 0x0F) + ((b & 0x0F) < 10 ? '0' : 'a'); 207 dest[i*2 + 1] = (b & 0x0F) + ((b & 0x0F) < 10 ? '0' : 'a');
208 } 208 }
209} 209}
210 210
@@ -223,14 +223,14 @@ int main(int argc, char *argv[]) {
223 checkrepopath(repopath); 223 checkrepopath(repopath);
224 224
225 const char *hrefbase = getenv("GITOLFS3_HREF_BASE"); 225 const char *hrefbase = getenv("GITOLFS3_HREF_BASE");
226 const char *keypath = getenv("GITOLFS3_KEY_PATH"); 226 const char *keypath = getenv("GITOLFS3_KEY_PATH");
227 227
228 if (!hrefbase || strlen(hrefbase) == 0) 228 if (!hrefbase || strlen(hrefbase) == 0)
229 die("Incomplete configuration: base URL not provided"); 229 die("Incomplete configuration: Base URL not provided");
230 if (hrefbase[strlen(hrefbase) - 1] != '/') 230 if (hrefbase[strlen(hrefbase) - 1] != '/')
231 die("Bad configuration: base URL should end with slash"); 231 die("Bad configuration: Base URL should end with slash");
232 if (!keypath || strlen(keypath) == 0) 232 if (!keypath || strlen(keypath) == 0)
233 die("Incomplete configuration: key path not provided"); 233 die("Incomplete configuration: Key path not provided");
234 234
235 uint8_t key[64]; 235 uint8_t key[64];
236 readkey(keypath, key); 236 readkey(keypath, key);