Remove getdisc function completely
The function getdisc doesn't seem to serve any purpose when it comes to checking user idle time, by the time it's called, the part of check_idle which checks access time to the terminal will have already finished, and there is no reason that a check for idle time on a terminal should act any differently based on the line discipline. Since the function serves no purpose, and the call and check of it's result seems like it only introduces a potential bug, and has no reason to be there, the function has been removed, as well as the code in chk_timeout which calls it. NOTE: at this point, the function didn't even check the line discipline, i gutted it so it would only return the constant N_TTY, i was planning on rewriting the function to get the terminal line discipline in a more portable way, since the original way wasn't, but ultimately decided it didn't even need to exist in the first place.
This commit is contained in:
		
							parent
							
								
									f5f7cf8153
								
							
						
					
					
						commit
						256a972787
					
				
					 1 changed files with 1 additions and 17 deletions
				
			
		
							
								
								
									
										18
									
								
								timeoutd.c
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								timeoutd.c
									
										
									
									
									
								
							|  | @ -94,7 +94,6 @@ void bailout(); | ||||||
| char chk_timeout(); | char chk_timeout(); | ||||||
| void logoff_msg(); | void logoff_msg(); | ||||||
| void killit(); | void killit(); | ||||||
| int getdisc(); |  | ||||||
| int chk_xsession();             /* seppy: is it a X-Session? */ | int chk_xsession();             /* seppy: is it a X-Session? */ | ||||||
| void killit_xsession();         /* seppy: kill the X-Session */ | void killit_xsession();         /* seppy: kill the X-Session */ | ||||||
| int chk_ssh(pid_t pid);         /* seppy: check if user is logged in via ssh (we have to
 | int chk_ssh(pid_t pid);         /* seppy: check if user is logged in via ssh (we have to
 | ||||||
|  | @ -739,7 +738,6 @@ int session; | ||||||
|     char usermatch = 0; |     char usermatch = 0; | ||||||
|     char groupmatch = 0; |     char groupmatch = 0; | ||||||
|     char **p; |     char **p; | ||||||
|     int disc; |  | ||||||
| 
 | 
 | ||||||
|     configline = 0; |     configline = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -784,15 +782,12 @@ int session; | ||||||
|                    config[configline]->sessmax, daytime, config[configline]->daymax, |                    config[configline]->sessmax, daytime, config[configline]->daymax, | ||||||
|                    config[configline]->warntime); |                    config[configline]->warntime); | ||||||
| #endif | #endif | ||||||
|             disc = getdisc(dev, host); |  | ||||||
| 
 |  | ||||||
|             limit_type = NOLOGINMSG; |             limit_type = NOLOGINMSG; | ||||||
|             if (!config[configline]->login_allowed) |             if (!config[configline]->login_allowed) | ||||||
|                 return NOLOGIN; |                 return NOLOGIN; | ||||||
| 
 | 
 | ||||||
|             limit_type = IDLEMSG; |             limit_type = IDLEMSG; | ||||||
|             if (disc == N_TTY && config[configline]->idlemax > 0 |             if (config[configline]->idlemax > 0 && idle >= config[configline]->idlemax) | ||||||
|                 && idle >= config[configline]->idlemax) |  | ||||||
|                 return IDLEMAX; |                 return IDLEMAX; | ||||||
| 
 | 
 | ||||||
|             limit_type = SESSMSG; |             limit_type = SESSMSG; | ||||||
|  | @ -1053,17 +1048,6 @@ int signum; | ||||||
|     signal(SIGCHLD, reapchild); |     signal(SIGCHLD, reapchild); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int getdisc(d, host) |  | ||||||
| char *d; |  | ||||||
| char *host; |  | ||||||
| { |  | ||||||
|     int fd; |  | ||||||
|     int disc; |  | ||||||
| 
 |  | ||||||
|     return N_TTY; |  | ||||||
|     /* TODO: add an actual portable way of getting terminal discipline */ |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int chk_xsession(dev, host)     /* returns TIMEOUTD_XSESSION_{REMOTE,LOCAL,NONE} when dev and host seem to be a xSession. */ | int chk_xsession(dev, host)     /* returns TIMEOUTD_XSESSION_{REMOTE,LOCAL,NONE} when dev and host seem to be a xSession. */ | ||||||
| char *dev, *host; | char *dev, *host; | ||||||
| { | { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Petar Kapris
						Petar Kapris