亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gw_stuff.c

?? 手機短消息服務的服務器和客戶端
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*========================================================== * Program : gw_stuff.c                    Project : smslink * Author  : Philippe Andersson. * Date    : 01/03/00 * Version : 0.16b * Notice  : (c) Les Ateliers du Heron, 1998 for Scitex Europe, S.A. * Comment : Library of functions for the smslink sms2mail gateway. * * Modification History : * - 0.01b (19/08/99) : Initial release. Moved the mail gateway- *   specific functions from stuff.c over here. * - 0.02b (28/09/99) : Created mailbox_run(). * - 0.03b (29/09/99) : Extensive rework. Added tkize_ibox_line(), *   reset_mail_struct() and parse_smail(). * - 0.04b (04/10/99) : Added expand_addr(). * - 0.05b (17/10/99) : Expanded parse_smail() extensively. * - 0.06b (19/10/99) : Debugged tkize_ibox_line(). Increased *   debugging output. Created shell for send_mail(). * - 0.07b (20/10/99) : Added mkfromfield(). * - 0.08b (21/10/99) : Added is_dotted_quad () and resolve(). * - 0.09b (08/11/99) : Built dialog in send_mail(). Added *   slurp_n_catch(). * - 0.10b (09/11/99) : Modified parse_smail() to provide a *   default subject field if the SMS doesn't contain one. Involved *   alter the parameters passed to the function. Cosmetics. * - 0.11b (12/11/99) : Improved send_mail() to free() the *   allocated space for the nicified date. * - 0.12b (30/11/99) : Added temp file creation to mailbox_run(). * - 0.13b (24/02/00) : Completed the transfer routine to the *   new mailbox file in mailbox_run(). * - 0.14b (26/02/00) : Made sure the lockfile (MBOX_LOCKF) was *   deleted on each fatal error, as well as on SIGTERM being *   caught (in mailgws_death()). Improved error reporting in *   various functions. Cosmetics. * - 0.15b (29/02/00) : Added functions to handle recepients *   lists (as part of struct email_msg). Heavily modified most *   functions (send_mail(), parse_smail(), expand_addr()) and *   created sub_tkize_field() to account for changes in the *   email_msg struct. * - 0.16b (01/03/00) : Replaced the "old" slurp_n_catch() by *   a new version inspired by get_gsm_answer() (cf. serv_stuff.c). *   This should be more robust and less sensitive to the amount *   of data sent back by the server (here: sendmail). Created *   the clean_field() function (forgotten when split expand_addr() *   from sub_tkize_field()). *========================================================*/#include <unistd.h>#include <stdio.h>                         /* for fprintf */#include <stdlib.h>                  /* for errno & stuff */#include <errno.h>#include <string.h>#include <syslog.h>#include <netdb.h>                 /* for gethostbyname() */#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/time.h>           /* for the struct timeval */#include <sys/types.h>#include <sys/ipc.h>#include <sys/ioctl.h>            /* for the ioctl() call */#ifdef LINUX_LC6#  include <limits.h>                     /* for PATH_MAX */#  include <linux/limits.h>#else#  include <limits.h>#endif#include "sms_serv.h"/*========================================================*//* For debugging purposes only - comment out for normal compile *//* #define INCL_DEBUG_CODE *//*========================================================*/void mailgws_death (){  extern int inbox_is_locked;    /* log it... */  syslog ((FACILITY | LOG_INFO), "gateway exiting on SIGTERM.");    /* remove inbox lock file if necessary */  if (inbox_is_locked) {    unlink (MBOX_LOCKF);  }  /* closes connection to the syslog daemon */  closelog ();    /* now exits gracefully */  exit (0);}                                     /* mailgws_death () *//*========================================================*/void rcpt_list_init (rcpt_list *list){  list->head = NULL;  list->tail = NULL;}                                    /* rcpt_list_init () *//*========================================================*/int empty_rcpt_list (rcpt_list list){  return (list.head == NULL);}                                   /* empty_rcpt_list () *//*========================================================*/void rcpt_list_insert (rcpt_list *list, char *recepient){  /* WARNING : the order of the elements might be relevent - let's   * store them as they were in the header => avoid inserting at   * list head. Do it at the tail. */    int l;  struct rcpt_item *element;  /* alloc memory for new element */  element = (struct rcpt_item *) malloc (sizeof (struct rcpt_item));  if (!element) {    syslog ((FACILITY | LOG_ERR), "can't malloc() for new RCPT entry.");    unlink (MBOX_LOCKF);    syserr ("sms2mailgw: can't malloc() for new RCPT entry");  }    /* initialize fields for new element */  l = strlen (recepient);  element->rcpt = (char *) malloc ((l + 1) * sizeof (char));  if (!element->rcpt) {    syslog ((FACILITY | LOG_ERR), "can't malloc() for new recepient string.");    unlink (MBOX_LOCKF);    syserr ("sms2mailgw: can't malloc() for new recepient string");  }  strcpy (element->rcpt, recepient);    /* chain it in the list */  if (empty_rcpt_list (*list)) {    list->head = element;    list->tail = element;    element->next = NULL;    element->prev = NULL;  }  else {    element->next = NULL;    element->prev = list->tail;    list->tail->next = element;    list->tail = element;  }}                                  /* rcpt_list_insert () *//*========================================================*/void free_rcpt_list (rcpt_list *list){  struct rcpt_item *cursor;  if (!empty_rcpt_list (*list)) {    /* hop to element before last */    cursor = list->tail->prev;    /* now go back and clean behind */    while (cursor != NULL) {      free (cursor->next->rcpt);      free (cursor->next);      cursor->next = NULL;      list->tail = cursor;      cursor = cursor->prev;    }                           /* while (cursor != NULL) */  }                          /* if (!empty_rcpt_list (... */  /* now clean last element and reset header */  free (list->head->rcpt);  free (list->head);  list->head = NULL;  list->tail = NULL;}                                    /* free_rcpt_list () *//*========================================================*/#ifdef INCL_DEBUG_CODEvoid print_rcpt_list (rcpt_list list){  struct rcpt_item *cursor;  if (!empty_rcpt_list (list)) {    cursor = list.head;    fprintf (stderr, "<%s>\n", cursor->rcpt);    while (cursor->next != NULL) {      cursor = cursor->next;      fprintf (stderr, "<%s>\n", cursor->rcpt);    }  }  else {    fprintf (stderr, "sms2mailgw: empty recepient list.\n");  }}                                    /* print_acl_list () */#endif/*========================================================*/int is_dotted_quad (char *string){  int is_dq;  char *s;  int ntok = 0;  char *ptok = NULL;  long int ip_byte;  char **endptr;  char *dummyp;    /*--------------------------------------Initializations */  s = (char *) malloc ((strlen (string) + 1) * sizeof (char));  if (! s) {    syslog ((FACILITY | LOG_ERR), "can't malloc().");    unlink (MBOX_LOCKF);    syserr ("sms2mailgw: can't malloc()");  }  strcpy (s, string);  /*--------------------------------------------Main Loop */  /* no point going any further if the 1st char. is not a digit */  is_dq = isdigit (string[0]);  if (is_dq) {    ptok = strtok (s, ".");    while (ptok != NULL) {      ntok++;#ifdef INCL_DEBUG_CODE      fprintf (stderr, "got token #%d : <%s>\n", ntok, ptok);#endif      dummyp = ptok + strlen (ptok);      endptr = &dummyp;      ip_byte = strtol (ptok, endptr, 10);      if (strlen (*endptr) != 0) {#ifdef INCL_DEBUG_CODE	fprintf (stderr, "error on token #%d : can't convert <%s>\n", ntok, *endptr);#endif	is_dq = FALSE;      }      ptok = strtok (NULL, ".");    }    if (ntok != 4) {      is_dq = FALSE;    }  }                                         /* if (is_dq) */  /*------------------------------------------Conclusions */  free (s);  /*-------------------------------------------------Exit */  return (is_dq);}                                    /* is_dotted_quad () *//*========================================================*/unsigned long int resolve (char *host)/* return the host ip address in network format */{  struct hostent *h_ent;  struct in_addr target_ip;  char **addrs;  char *scratch;    if (is_dotted_quad (host)) {#ifdef INCL_DEBUG_CODE    fprintf (stderr, "I think I got an IP address\n");#endif    if (inet_aton (host, &target_ip) == 0)      syslog ((FACILITY | LOG_ERR), "invalid server IP address (%s).", host);      scratch = (char *) malloc ((MINIBUFF + 1) * sizeof (char));      sprintf (scratch, "sms2mailgw: invalid server IP address (%s)", host);      herror (scratch);      free (scratch);      unlink (MBOX_LOCKF);      exit (1);  }  else {#ifdef INCL_DEBUG_CODE    fprintf (stderr, "I think I got a host name\n");#endif    if ((h_ent = gethostbyname (host)) == NULL) {      syslog ((FACILITY | LOG_ERR), "can't resolve hostname (%s).", host);      scratch = (char *) malloc ((MINIBUFF + 1) * sizeof (char));      sprintf (scratch, "sms2mailgw: can't resolve hostname (%s)", host);      herror (scratch);      free (scratch);      unlink (MBOX_LOCKF);      exit (1);    }    /* lines below cf. "Beginning Linux Progr.", pp. 468-473 */    addrs = h_ent->h_addr_list;    target_ip = *(struct in_addr *)*addrs;#ifdef INCL_DEBUG_CODE    fprintf (stderr, "server IP address is: [%s]\n", inet_ntoa (target_ip));#endif  }                             /* if (isdigit (host[0])) */  return (target_ip.s_addr);}                                           /* resolve () *//*========================================================*/int tkize_ibox_line (char *l, struct inbox_line *tkl){  char *token;  char *scratch;    /*--------------------------------------Initializations */  /* copy input string to scratch space - we can't modify it */  scratch = (char *) malloc ((strlen (l) + 1) * sizeof (char));  if (! scratch) {    syslog ((FACILITY | LOG_ERR), "can't malloc().");    unlink (MBOX_LOCKF);    syserr ("sms2mailgw: can't malloc()");  }  scratch[0] = '\0';  strcpy (scratch, l);    /*--------------------------------------Parsing routine */  /*...............................................Device */  if ((token = strtok (scratch, ",")) == NULL) {    return (-1);  }  strcpy (tkl->device, token);    /*................................................MsgID */  if ((token = strtok (NULL, ",")) == NULL) {    return (-1);  }  tkl->msgid = atoi (token);    /*..............................................FromGSM */  if ((token = strtok (NULL, ",")) == NULL) {    return (-1);  }  strcpy (tkl->fromgsm, token);    /*.................................................Date */  if ((token = strtok (NULL, ",")) == NULL) {    return (-1);  }  strcpy (tkl->date, token);    /*.................................................Time */  if ((token = strtok (NULL, ",")) == NULL) {    return (-1);  }  strcpy (tkl->time, token);    /*.................................................Text */  /* just grab the rest of the line */  if ((token = strtok (NULL, "\0")) == NULL) {    return (-1);  }  /* remove trailing LF */  token[strlen (token) - 1] = '\0';  dequote (token);  strcpy (tkl->text, token);    /*-------------------------------------------------Exit */  free (scratch);  return 0;                                    /* success */}                                   /* tkize_ibox_line () *//*========================================================*/char *expand_addr (char *field, char *defdom){  char *newstring;  /*---------------------------------------Initialization */  newstring = (char *) malloc ((BIGBUFF + 1) * sizeof (char));  if (! newstring) {    syslog ((FACILITY | LOG_ERR), "can't malloc().");    unlink (MBOX_LOCKF);    syserr ("sms2mailgw: can't malloc()");  }  newstring[0] = '\0';    /*---------------------------------Main processing loop */  if (strchr (field, '@') == NULL) {    sprintf (newstring, "%s@%s", field, defdom);  }  else {    strcpy (newstring, field);  }  /*------------------------------------------Conclusions */#ifdef INCL_DEBUG_CODE  fprintf (stderr, "expanded field: [%s]\n", newstring);#endif  return (newstring);}                                       /* expand_addr () *//*========================================================*/char *clean_field (char *field)/* For fields that cannot be multi-part (Reply-to:), remove * the field header and any additional address. */{  char *ptr;    /* The field for sure has a field header - skip it */  shiftleft (field, 2);  /* If the first char now is a space, skip that as well */  if (field[0] == ' ') {    shiftleft (field, 1);  }  /* If the field contains a comma, kill it and all that follows */  if ((ptr = strchr (field, ',')) != NULL) {    ptr[0] = '\0';  }    return (field);}                                       /* clean_field () *//*========================================================*/int sub_tkize_field (rcpt_list *list, char *field, char *defdom){  int nfields = 0;  char *s;  char *ptr;  char *newstring;  char *item;    /*---------------------------------------Initialization */  /* take a local copy of "field" to avoid it being modified */  s = (char *) malloc ((strlen (field) + 1) * sizeof (char));  if (! s) {    syslog ((FACILITY | LOG_ERR), "can't malloc().");    unlink (MBOX_LOCKF);    syserr ("sms2mailgw: can't malloc()");  }  s[0] = '\0';  strcpy (s, field);  ptr = s;    /* s for sure has a field header ("T:" for inst.) - skip it */  ptr += 2;  /* if there was a blank between the header and the field, skip it too */  if (ptr[0] == ' ') {    ptr++;  }    /*---------------------------------Main processing loop */  if ((item = strtok (ptr, ",")) == NULL) {    /* field header w/o contents */    free (s);    return (nfields);  }  /* process first item */  newstring = expand_addr (item, defdom);  rcpt_list_insert (list, newstring);  nfields++;  free (newstring);    /* now tokenize and process the rest */  while ((item = strtok (NULL, ",")) != NULL) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美高清你懂得| 亚洲精品一区二区在线观看| 欧美三区在线观看| 久久久久久综合| 日韩精品一区第一页| 成人动漫精品一区二区| 日韩欧美一级精品久久| 亚洲宅男天堂在线观看无病毒| 国产精品中文字幕欧美| 欧美日韩精品高清| 一区二区高清在线| 色综合一区二区| 成人欧美一区二区三区白人 | 欧美videos中文字幕| 国内外成人在线| 3d动漫精品啪啪一区二区竹菊| 国产精品久久久久桃色tv| 国内精品伊人久久久久av影院 | 欧美激情中文字幕一区二区| 日韩国产精品大片| 欧美日韩中文国产| 亚洲成人资源网| 欧洲精品一区二区| 日韩美女精品在线| 一本色道久久综合狠狠躁的推荐| 亚洲国产精品高清| 国产成人免费在线观看| 国产三级一区二区三区| 乱一区二区av| www国产成人免费观看视频 深夜成人网| 偷拍亚洲欧洲综合| 精品视频123区在线观看| 亚洲一区在线观看免费| 99在线热播精品免费| 国产精品久久久久久福利一牛影视| 国产美女久久久久| 国产精品久久毛片av大全日韩| 国精产品一区一区三区mba视频| 日韩限制级电影在线观看| 日韩中文字幕91| 日韩免费在线观看| 国产成人啪午夜精品网站男同| 久久久久久夜精品精品免费| 国产 欧美在线| 综合色天天鬼久久鬼色| 99久久综合狠狠综合久久| 亚洲欧美日韩系列| 欧美精品丝袜久久久中文字幕| 欧美bbbbb| 久久久久久久性| 色综合网站在线| 天天影视涩香欲综合网| 精品处破学生在线二十三| 国产成人精品亚洲午夜麻豆| 亚洲国产精品成人综合| 欧美高清一级片在线观看| 99精品视频一区二区三区| 亚洲一区二区在线免费观看视频| 欧美日韩夫妻久久| 国产精品自在欧美一区| 亚洲久草在线视频| 日韩精品最新网址| av色综合久久天堂av综合| 亚洲电影一级片| 久久久国产一区二区三区四区小说| 99国产欧美另类久久久精品| 日韩精品91亚洲二区在线观看| 久久久天堂av| 欧美色视频在线| 福利电影一区二区| 性欧美大战久久久久久久久| 久久久亚洲精华液精华液精华液| 91在线观看一区二区| 日韩综合在线视频| 亚洲色图一区二区三区| 日韩精品一区二区三区老鸭窝 | 国内精品在线播放| 亚洲第一av色| 中文字幕中文字幕在线一区| 欧美一区二区三区在线看| 日韩欧美综合一区| 日本电影亚洲天堂一区| 国产揄拍国内精品对白| 日韩精品视频网站| 亚洲激情一二三区| 国产亲近乱来精品视频| 欧美一级夜夜爽| 在线视频一区二区三| 成人av电影在线| 国产福利91精品一区| 久久99精品久久久久久| 午夜精品一区二区三区免费视频| 成人欧美一区二区三区| 国产天堂亚洲国产碰碰| 欧美成人精品3d动漫h| 欧美日韩一卡二卡| 欧美色窝79yyyycom| 99久久综合狠狠综合久久| 国产精品123区| 久久国产欧美日韩精品| 午夜天堂影视香蕉久久| 一区二区三区在线观看网站| 国产精品电影一区二区三区| 久久久国产精品午夜一区ai换脸| 日韩欧美在线网站| 欧美一三区三区四区免费在线看| 色呦呦国产精品| 99久久99久久精品国产片果冻 | 人人狠狠综合久久亚洲| 无吗不卡中文字幕| 日韩电影在线观看电影| 亚洲成人午夜电影| 亚洲国产精品影院| 亚洲一区二区三区激情| 一区二区在线观看免费视频播放| 亚洲欧洲另类国产综合| 亚洲天堂精品视频| 亚洲美女少妇撒尿| 一区二区三区欧美在线观看| 亚洲欧洲国产日韩| 亚洲综合av网| 日本欧美一区二区在线观看| 麻豆一区二区99久久久久| 日本不卡123| 黑人巨大精品欧美黑白配亚洲| 国产综合色在线视频区| 国产成人精品免费在线| 91亚洲精品久久久蜜桃网站 | 欧美精品一区二区三区很污很色的 | 欧美久久久久免费| 日韩一区二区在线免费观看| 日韩亚洲电影在线| 日本一区二区免费在线| 中文字幕一区二区三区在线观看 | 国产精品免费观看视频| 亚洲美女精品一区| 日韩主播视频在线| 国产成人av资源| 日本久久一区二区| 91精品国产91久久久久久最新毛片 | 麻豆精品新av中文字幕| 国产成人在线免费| 欧美色涩在线第一页| 精品日韩一区二区| 自拍视频在线观看一区二区| 视频一区二区中文字幕| 狠狠色丁香久久婷婷综合丁香| 97精品视频在线观看自产线路二| 欧美三级日韩三级国产三级| 精品美女一区二区三区| 综合激情网...| 久久精品国产免费看久久精品| a级高清视频欧美日韩| 欧美人狂配大交3d怪物一区| 国产人妖乱国产精品人妖| 亚洲大型综合色站| 成人精品高清在线| 欧美成人性福生活免费看| 中文字幕综合网| 国产中文一区二区三区| 欧美日韩一区二区不卡| 国产丝袜欧美中文另类| 免费成人美女在线观看.| 99国产精品久久| 久久久青草青青国产亚洲免观| 亚洲444eee在线观看| av在线播放一区二区三区| 日韩一区二区三区电影| 亚洲午夜在线观看视频在线| 国产99久久久久久免费看农村| 欧美一激情一区二区三区| 亚洲狠狠丁香婷婷综合久久久| 国产精一品亚洲二区在线视频| 欧美日韩精品一区二区天天拍小说| 亚洲欧洲精品成人久久奇米网| 国产主播一区二区| 欧美sm美女调教| 丝袜a∨在线一区二区三区不卡| 色婷婷综合五月| 国产精品免费网站在线观看| 国产一区二区在线影院| 日韩一二三四区| 日本欧美一区二区| 欧美另类一区二区三区| 亚洲综合激情小说| 色噜噜狠狠成人中文综合| 国产精品麻豆视频| 国产精品一二三四| 国产午夜精品理论片a级大结局| 久久精品72免费观看| 欧美一级片免费看| 日韩黄色小视频| 日韩欧美在线一区二区三区| 日韩激情一二三区| 日韩欧美二区三区| 蜜臀久久99精品久久久久宅男| 欧美一区二区高清| 久久国产麻豆精品| 久久久精品国产99久久精品芒果 | 在线看不卡av|