Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Commit

Permalink
load server from krb config
Browse files Browse the repository at this point in the history
  • Loading branch information
schorschii committed Apr 19, 2021
1 parent 2157a33 commit 683cea1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions ldappwd@schorschii/desklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ MyDesklet.prototype = {
this.refreshDesklet();
});

// ldap server (domain controller)
// ldap server (domain controller) via Samba config
let fileSmbConf = Gio.file_new_for_path("/etc/samba/smb.conf");
fileSmbConf.load_contents_async(null, (file, response) => {
try {
Expand All @@ -125,7 +125,27 @@ MyDesklet.prototype = {
let lines = contents.toString().split("\n");
for(var i = 0; i < lines.length; i++) {
if(lines[i].trim().startsWith("password server = ")) {
this.serverAddress = lines[i].split(" ")[3].trim().split(",")[0].trim();
this.serverAddress = lines[i].trim().split(" ")[3].trim().split(",")[0].trim();
}
}
}
GLib.free(contents);
} catch(err) {
this.currentError = 1;
}
this.refreshDesklet();
});

// ldap server (domain controller) via krb config
let fileKrbConf = Gio.file_new_for_path("/etc/krb5.conf");
fileKrbConf.load_contents_async(null, (file, response) => {
try {
let [success, contents, tag] = file.load_contents_finish(response);
if(success) {
let lines = contents.toString().split("\n");
for(var i = 0; i < lines.length; i++) {
if(lines[i].trim().startsWith("kdc = ")) {
this.serverAddress = lines[i].trim().split(" ")[2].trim();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ldappwd@schorschii/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"uuid": "ldappwd@schorschii",
"max-instances": "10",
"description": "See when your domain password expires and change it.",
"version": "1.1",
"version": "1.2",
"name": "LDAP Password Expiry Tool"
}

0 comments on commit 683cea1

Please sign in to comment.