diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b86185 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/kissy diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b3fbc1e --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +CC := gcc +CFLAGS := -O2 -pipe -Wall -Wextra +INSTALL := install +PREFIX := /usr/local +BINDIR := bin + +.PHONY: all +all: kissy + +kissy: kissy.c + $(CC) $(CFLAGS) -o kissy kissy.c + +.PHONY: install +install: + $(INSTALL) -Dm2755 -oroot -gtty -s kissy $(DESTDIR)$(PREFIX)/$(BINDIR)/kissy + +.PHONY: clean +clean: + rm -f kissy diff --git a/README.md b/README.md index bb715d1..a052f0d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ Ever wanted to kiss girls through a tty? Well now you can! - run `sudo chown root:tty /path/to/kissy` (or whatever ownership it's supposed to have) - run `sudo chmod 2755 /path/to/kissy` (or whatever permissions work for you. has to run with setgid) +- alternatively, build kissy from source using `make` then `sudo make install` + ### Usage: `kissy [target] ` @@ -18,4 +20,4 @@ Have fun girlkissing! :3 ## License -This project is licensed with [GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt) \ No newline at end of file +This project is licensed with [GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt) diff --git a/kissy.c b/kissy.c index 5167a5b..4c7763d 100644 --- a/kissy.c +++ b/kissy.c @@ -53,7 +53,7 @@ int main (int argc, char **argv) { printf("%s\n", "Cannot find target"); return 1; } - int target = pw->pw_uid; + uid_t target = pw->pw_uid; // get current username struct passwd *pw2 = getpwuid(getuid()); @@ -74,7 +74,7 @@ int main (int argc, char **argv) { // iterate over all files in directory DIR *dir = opendir("/dev/pts"); while (1) { - struct dirent *ent = readdir (dir); + struct dirent *ent = readdir(dir); if (ent == NULL) break; @@ -90,7 +90,7 @@ int main (int argc, char **argv) { kissed = true; if (stats.st_gid != getegid()) { // are we running as the tty user? - printf("%s\n", "Mismatch between file owner group and current effective group. Make sure this program is running with setgid."); + fprintf(stderr, "%s\n", "Mismatch between file owner group and current effective group. Make sure this program is running with setgid."); } else { FILE *tty = fopen(filepath, "a"); // write to terminal! fprintf(tty, "\n%s\n--%s\n", kiss, user); @@ -101,5 +101,5 @@ int main (int argc, char **argv) { // print a message if a suitable terminal couldn't be found if (!kissed) - printf("%s\n", "Couldn't find any suitable terminals. User is not logged in or has not enabled messages."); -} \ No newline at end of file + fprintf(stderr, "%s\n", "Couldn't find any suitable terminals. User is not logged in or has not enabled messages."); +}