Skip to content

Commit

Permalink
API: Create socket with user-only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bozaro committed Feb 5, 2016
1 parent fbe39e3 commit ac81a55
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion build.gradle
Expand Up @@ -29,6 +29,9 @@ allprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://bozaro.github.io/junixsocket"
}
}
}

Expand Down Expand Up @@ -110,7 +113,7 @@ dependencies {
compile "com.esotericsoftware:kryo:3.0.3"
compile "org.bitbucket.b_c:jose4j:0.4.4"
compile "com.google.guava:guava:19.0"
compile "com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4"
compile "com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4.1"

compile "ru.bozaro.gitlfs:gitlfs-pointer:0.9.0"
compile "ru.bozaro.gitlfs:gitlfs-client:0.9.0"
Expand Down
1 change: 1 addition & 0 deletions cfg/config-local.example
Expand Up @@ -86,6 +86,7 @@ shared:
path: /api
- !socket
path: git-as-svn.socket
mode: 600

# Simple in-memory user database
userDB: !localUsers
Expand Down
2 changes: 1 addition & 1 deletion cfg/git-lfs-authenticate.cfg
Expand Up @@ -2,7 +2,7 @@
#
# Git-as-svn API domain socket file.
#
socket-file = /var/run/git-as-svn/git-as-svn.socket
socket-file = /var/run/git-as-svn.socket

#
# Authentification mode:
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/svnserver/ext/socket/config/SocketConfig.java
Expand Up @@ -31,6 +31,8 @@ public class SocketConfig implements SharedConfig {
private static final Logger log = LoggerFactory.getLogger(SocketConfig.class);
@NotNull
private String path = "git-as-svn.socket";
@NotNull
private String mode = "600";

@Override
public void create(@NotNull SharedContext context) throws IOException {
Expand All @@ -44,7 +46,7 @@ public void create(@NotNull SharedContext context) throws IOException {
//noinspection ResultOfMethodCallIgnored
socketFile.delete();
}
socket.bind(new AFUNIXSocketAddress(socketFile));
socket.bind(new AFUNIXSocketAddress(socketFile, 0, Integer.parseInt(mode, 8)));
context.add(SocketRpc.class, new SocketRpc(context, socket));
}

Expand Down
2 changes: 1 addition & 1 deletion tools/git-lfs-authenticate
Expand Up @@ -15,7 +15,7 @@ else:

def load_config():
config = configparser.SafeConfigParser({
"socket-file": "/var/run/git-as-svn/git-as-svn.socket",
"socket-file": "/var/run/git-as-svn.socket",
"mode": "username",
"variable": "USER",
})
Expand Down

0 comments on commit ac81a55

Please sign in to comment.