RDEV-1131 Additional border for the qrcode

This commit is contained in:
przemyslaw.szeremeta 2019-10-30 08:39:19 +01:00
parent a7329b6e02
commit d021a99ecc
3 changed files with 17 additions and 4 deletions

Binary file not shown.

View File

@ -68,15 +68,28 @@ char *parseJson(char source[], char name[] ) {
void printQr(const uint8_t qrcode[],pam_handle_t *pamh) {
char *qrCodeString = "";
char *white = "\u2588\u2588";
char *black = " ";
int size = qrcodegen_getSize(qrcode);
int border = 1;
int y;
//additional line above
for(y = -border; y < size + border + 2; y++){
asprintf(&qrCodeString,"%s%s", qrCodeString, white);
}
asprintf(&qrCodeString,"%s%s", qrCodeString, "\n");
for(y = -border; y < size + border; y++) {
int x;
asprintf(&qrCodeString,"%s%s",qrCodeString,white);
for(x = -border; x < size + border; x++)
asprintf(&qrCodeString,"%s%s",qrCodeString,qrcodegen_getModule(qrcode, x, y) ? " " : "\u2588\u2588");
asprintf(&qrCodeString,"%s%s",qrCodeString,qrcodegen_getModule(qrcode, x, y) ? black : white);
asprintf(&qrCodeString,"%s%s",qrCodeString,white);
asprintf(&qrCodeString,"%s%s",qrCodeString,"\n");
}
//additional line below
for(y = -border; y < size + border + 2; y++){
asprintf(&qrCodeString,"%s%s", qrCodeString, white);
}
asprintf(&qrCodeString,"%s%s",qrCodeString,"\n");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "%s",qrCodeString);

6
Vagrantfile vendored
View File

@ -86,8 +86,8 @@ Vagrant.configure("2") do |config|
make selinux
make install
useradd -s /bin/bash -m kwa
echo "kwa:kwa"|chpasswd
useradd -s /bin/bash -m psz
echo "psz:psz"|chpasswd
grep -q -e '#auth substack password-auth' /etc/pam.d/sshd || sed -i -e 's/auth substack password-auth/#auth substack password-auth/g' /etc/pam.d/sshd
grep -q -e 'auth requisite pam_unix.so' /etc/pam.d/sshd || sed -i '\$aauth requisite pam_unix.so' /etc/pam.d/sshd
@ -96,6 +96,6 @@ Vagrant.configure("2") do |config|
service sshd restart
#vagrant ssh -p -- -l kwa
#vagrant ssh -p -- -l psz
SHELL
end