Remove paths. prefix from call sites
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 3 Apr 2012 13:09:28 +0000 (09:09 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 3 Apr 2012 13:32:06 +0000 (09:32 -0400)
main.go
server/paths.go
server/server.go

diff --git a/main.go b/main.go
index fec54113c1f2ca524220481d6a4927ca5d27a88b..5fe6ef43cd9eb93505329b36492eb52a95cf6e24 100644 (file)
--- a/main.go
+++ b/main.go
@@ -53,6 +53,6 @@ func main() {
        // Run the server.
        fmt.Printf("Starting Armadillo on port %d with root:\n  %v\n",
                configuration.Port, configuration.JailRoot)
-       paths.SetConfig(configuration)
+       server.SetConfig(configuration)
        server.RunBackEnd(configuration)
 }
index b18359e5b28c2053d74001dd4459e07ac3441373..ee46174b6dcf7e88e60bf47fbe1858438d276dd6 100644 (file)
@@ -41,13 +41,13 @@ func checkInJail(the_path string) bool {
        return true
 }
 
-func IsValid(path string) (bool, string) {
+func IsValidPathPath(path string) (bool, string) {
        path = canonicalizePath(path)
        _, err := os.Lstat(path)
        return err == nil && checkInJail(path), path
 }
 
-func List(the_path string) (files []string, err error) {
+func ListPath(the_path string) (files []string, err error) {
        full_path := canonicalizePath(the_path)
        if !checkInJail(full_path) {
                return nil, errors.New("Path outside of jail")
@@ -77,7 +77,7 @@ func List(the_path string) (files []string, err error) {
        return files, nil
 }
 
-func Remove(the_path string) error {
+func RemovePath(the_path string) error {
        full_path := canonicalizePath(the_path)
        if !checkInJail(full_path) {
                return errors.New("Path outside of jail")
@@ -85,7 +85,7 @@ func Remove(the_path string) error {
        return os.RemoveAll(full_path)
 }
 
-func Move(source string, target string) error {
+func MovePath(source string, target string) error {
        source = canonicalizePath(source)
        target = canonicalizePath(target)
        if !checkInJail(source) {
index 88ad93001ec4ef7ff65763ee40dfaf8b33f321e6..d5082908cfac056cfd206ee49aa1cc71cfd403c6 100644 (file)
@@ -47,14 +47,14 @@ func serviceHandler(response http.ResponseWriter, request *http.Request) {
 
        switch request.FormValue("action") {
        case "list":
-               files, err := paths.List(request.FormValue("path"))
+               files, err := ListPath(request.FormValue("path"))
                if err != nil {
                        errorResponse(response, err.Error())
                } else {
                        okResponse(response, files)
                }
        case "remove":
-               err := paths.Remove(request.FormValue("path"))
+               err := RemovePath(request.FormValue("path"))
                if err != nil {
                        errorResponse(response, err.Error())
                } else {
@@ -66,7 +66,7 @@ func serviceHandler(response http.ResponseWriter, request *http.Request) {
        case "move":
                source := request.FormValue("source")
                target := request.FormValue("target")
-               err := paths.Move(source, target)
+               err := MovePath(source, target)
                if err != nil {
                        errorResponse(response, err.Error())
                } else {
@@ -78,7 +78,7 @@ func serviceHandler(response http.ResponseWriter, request *http.Request) {
                }
        case "mkdir":
                path := request.FormValue("path")
-               err := paths.MakeDir(path)
+               err := MakeDir(path)
                if err != nil {
                        errorResponse(response, err.Error())
                } else {
@@ -158,7 +158,7 @@ func performProxy(url_ *url.URL, response http.ResponseWriter, origRequest *http
 }
 
 func downloadHandler(response http.ResponseWriter, request *http.Request) {
-       valid, fullPath := paths.IsValid(request.FormValue("path"))
+       valid, fullPath := IsValidPath(request.FormValue("path"))
        if valid {
                info, _ := os.Lstat(fullPath) // Error is already checked by |valid|.
                if info.IsDir() {