check for return values!!!
This commit is contained in:
		@@ -91,20 +91,27 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
				printf(" You're in !\n");
 | 
									printf(" You're in !\n");
 | 
				
			||||||
				passwddata->pwfailed = 0;
 | 
									passwddata->pwfailed = 0;
 | 
				
			||||||
				passwddata->pwage = passwddata->pwage + 1;
 | 
									passwddata->pwage = passwddata->pwage + 1;
 | 
				
			||||||
				mysetpwent(user, passwddata);
 | 
									if (mysetpwent(user, passwddata) < 0) {     /* execute the command  */
 | 
				
			||||||
 | 
										perror("Error");exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				if (passwddata->pwage > 100) {
 | 
									if (passwddata->pwage > 100) {
 | 
				
			||||||
					printf(" Your password is OLD!!!!\n");
 | 
										printf(" Your password is OLD!!!!\n");
 | 
				
			||||||
				} 
 | 
									} 
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				/*  check UID, see setuid(2) */
 | 
									/*  check UID, see setuid(2) */
 | 
				
			||||||
				setuid(passwddata->uid);
 | 
									
 | 
				
			||||||
 | 
									if (setuid(passwddata->uid) < 0) {     /* execute the command  */
 | 
				
			||||||
 | 
										perror("Error");exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				/*  start a shell, use execve(2) */
 | 
									/*  start a shell, use execve(2) */
 | 
				
			||||||
				if (execve("/bin/bash",NULL,NULL) < 0) {     /* execute the command  */
 | 
									if (execve("/bin/bash",NULL,NULL) < 0) {     /* execute the command  */
 | 
				
			||||||
					perror("Error");exit(EXIT_FAILURE);
 | 
										perror("Error");exit(EXIT_FAILURE);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				passwddata->pwfailed = passwddata->pwfailed + 1;
 | 
									passwddata->pwfailed = passwddata->pwfailed + 1;
 | 
				
			||||||
				mysetpwent(user, passwddata);
 | 
									if (mysetpwent(user, passwddata) < 0) {     /* execute the command  */
 | 
				
			||||||
 | 
										perror("Error");exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		printf("Login Incorrect \n");
 | 
							printf("Login Incorrect \n");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user