alpine 3.6
obsolete weakness #277

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

slim/src/slim-1.3.6/slimlock.cpp

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

 	wa.override_redirect = 1;
	wa.background_pixel = BlackPixel(dpy, scr);

	// Create a full screen window
	Window root = RootWindow(dpy, scr);
	win = XCreateWindow(dpy,
	  root,
	  0,
	  0,
	  DisplayWidth(dpy, scr),
	  DisplayHeight(dpy, scr),
	  0,
	  DefaultDepth(dpy, scr),
	  CopyFromParent,
	  DefaultVisual(dpy, scr),
	  CWOverrideRedirect | CWBackPixel,
	  &wa);
	XMapWindow(dpy, win);

	XFlush(dpy);
	for (int len = 1000; len; len--) {
		if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
			== GrabSuccess)
			break;
		usleep(1000);
	}
	XSelectInput(dpy, win, ExposureMask | KeyPressMask);

	// This hides the cursor if the user has that option enabled in their
	// configuration
	HideCursor();

	loginPanel = new Panel(dpy, scr, win, cfg, themedir, Panel::Mode_Lock);

	int ret = pam_start(APPNAME, loginPanel->GetName().c_str(), &conv, &pam_handle);
	// If we can't start PAM, just exit because slimlock won't work right
	if (ret != PAM_SUCCESS)
		die("PAM: %s\n", pam_strerror(pam_handle, ret));

	// disable tty switching
	if(cfg->getOption("tty_lock") == "1") {
		if ((term = open("/dev/console", O_RDWR)) == -1)
			perror("error opening console");

		if ((ioctl(term, VT_LOCKSWITCH)) == -1)
			perror("error locking console");
	}

	// Set up DPMS
	unsigned int cfg_dpms_standby, cfg_dpms_off; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.