util.c
来自「这是一个完全开放的」· C语言 代码 · 共 58 行
C
58 行
/* * jabberd - Jabber Open Source Server * Copyright (c) 2002 Jeremie Miller, Thomas Muldowney, * Ryan Eatmon, Robert Norris * * 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., 59 Temple Place, Suite 330, Boston, MA02111-1307USA */#include "s2s.h"/** generate a local/remote route key */char *s2s_route_key(pool p, char *local, char *remote) { char *key; if(p == NULL) key = (char *) malloc(strlen(local) + strlen(remote) + 2); else key = (char *) pmalloc(p, strlen(local) + strlen(remote) + 2); sprintf(key, "%s/%s", local, remote); return key;}/** generate a dialback key */char *s2s_db_key(pool p, char *secret, char *remote, char *id) { char hash[41], buf[1024]; _sx_debug(ZONE, "generating dialback key, secret %s, remote %s, id %s", secret, remote, id); shahash_r(secret, hash); snprintf(buf, 1024, "%s%s", hash, remote); shahash_r(buf, hash); snprintf(buf, 1024, "%s%s", hash, id); shahash_r(buf, hash); _sx_debug(ZONE, "dialback key generated: %s", hash); if(p == NULL) return strdup(hash); else return pstrdup(p, hash);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?