⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 match.c

📁 一个功能非常全面的代理服务器源代码程序,
💻 C
字号:
/* $Id: match.c,v 1.2 2005/05/17 16:56:29 hno Exp $ * Copyright (C) 2002 Rodrigo Campos** This program is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.* * This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* GNU General Public License for more details.* * You should have received a copy of the GNU General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.** Author: Rodrigo Campos (rodrigo@geekbunker.org)* */#include <stdio.h>#include <string.h>#include <sys/types.h>#include <grp.h>intmatch_user (char *dict_username, char *username){  if ((strcmp (dict_username, username)) == 0) {    return 1;  } else {    if ((strcmp (dict_username, "ALL")) == 0) {      return 1;    }  }  return 0;}				/* match_user */intmatch_group (char *dict_group, char *username){  struct group *g;		/* a struct to hold group entries */  dict_group++;			/* the @ should be the first char				   so we rip it off by incrementing 				   * the pointer by one */  if ((g = getgrnam (dict_group)) == NULL) {    fprintf (stderr, "helper: Group does not exist '%s'\n",	     dict_group);    return 0;  } else {    while (*(g->gr_mem) != NULL) {      if (strcmp (*((g->gr_mem)++), username) == 0) {	return 1;      }    }  }  return 0;}				/* match_group */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -